diff --git a/api/js/etemplate/et2_extension_customfields.js b/api/js/etemplate/et2_extension_customfields.js index b6465455a3..9cd467d969 100644 --- a/api/js/etemplate/et2_extension_customfields.js +++ b/api/js/etemplate/et2_extension_customfields.js @@ -162,7 +162,7 @@ var et2_customfields_list = /** @class */ (function (_super) { 'id': id, 'statustext': field.help, 'needed': field.needed, - 'readonly': this.getArrayMgr("readonlys").isReadOnly(id, null, this.options.readonly), + 'readonly': this.getArrayMgr("readonlys").isReadOnly(id, "" + this.options.readonly), 'value': this.options.value[this.options.prefix + field_name] }); // Can't have a required readonly, it will warn & be removed later, so avoid the warning @@ -550,6 +550,18 @@ var et2_customfields_list = /** @class */ (function (_super) { } return false; }; + /** + * Display links in list as CF name + * @param field_name + * @param field + * @param attrs + */ + et2_customfields_list.prototype._setup_url = function (field_name, field, attrs) { + if (this.getType() == 'customfields-list') { + attrs.label = field.label; + } + return true; + }; /** * Set which fields are visible, by name * diff --git a/api/js/etemplate/et2_extension_customfields.ts b/api/js/etemplate/et2_extension_customfields.ts index e44dd782e9..85c36e51de 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -21,6 +21,7 @@ import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_widget"; import {ClassWithAttributes} from "./et2_core_inheritance"; import {et2_valueWidget} from "./et2_core_valueWidget"; +import {et2_readonlysArrayMgr} from "./et2_core_arrayMgr"; export class et2_customfields_list extends et2_valueWidget implements et2_IDetachedDOM, et2_IInput { @@ -239,7 +240,7 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac 'id': id, 'statustext': field.help, 'needed': field.needed, - 'readonly': this.getArrayMgr("readonlys").isReadOnly(id, null, this.options.readonly), + 'readonly':( this.getArrayMgr("readonlys")).isReadOnly(id, ""+this.options.readonly), 'value': this.options.value[this.options.prefix + field_name] }); // Can't have a required readonly, it will warn & be removed later, so avoid the warning @@ -741,6 +742,22 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac return false; } + /** + * Display links in list as CF name + * @param field_name + * @param field + * @param attrs + */ + _setup_url( field_name, field, attrs) + { + if(this.getType() == 'customfields-list') + { + attrs.label = field.label; + } + + return true; + } + /** * Set which fields are visible, by name * diff --git a/api/js/etemplate/et2_widget_url.js b/api/js/etemplate/et2_widget_url.js index 5751e98083..989cb1c809 100644 --- a/api/js/etemplate/et2_widget_url.js +++ b/api/js/etemplate/et2_widget_url.js @@ -318,6 +318,17 @@ var et2_url_ro = /** @class */ (function (_super_1) { _this.setDOMNode(_this.span[0]); return _this; } + /** + * Set the text of the link to the label + * + * @param _value + */ + et2_url_ro.prototype.set_label = function (_value) { + this.options.label = _value; + if (this.span) { + this.span.text(_value); + } + }; et2_url_ro.prototype.set_value = function (_value) { this.value = _value; var link = et2_url.prototype.get_link(this.getType(), _value); @@ -326,7 +337,7 @@ var et2_url_ro = /** @class */ (function (_super_1) { this.span.removeAttr("href"); return; } - this.span.text(_value); + this.span.text(this.options.label || _value); switch (this.getType()) { case "url": this.span.attr("href", link).attr("target", "_blank"); diff --git a/api/js/etemplate/et2_widget_url.ts b/api/js/etemplate/et2_widget_url.ts index 56ecafd0f5..21d2df8cc3 100644 --- a/api/js/etemplate/et2_widget_url.ts +++ b/api/js/etemplate/et2_widget_url.ts @@ -353,6 +353,20 @@ export class et2_url_ro extends et2_valueWidget this.setDOMNode(this.span[0]); } + /** + * Set the text of the link to the label + * + * @param _value + */ + set_label(_value) + { + this.options.label = _value; + if(this.span) + { + this.span.text(_value); + } + } + set_value(_value) { this.value = _value; @@ -365,7 +379,7 @@ export class et2_url_ro extends et2_valueWidget this.span.removeAttr("href"); return; } - this.span.text(_value); + this.span.text(this.options.label || _value); switch(this.getType()) { case "url":