mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
Etemplate: Change r/o URLs to use label as link text
This commit is contained in:
parent
ab3ee4ffbb
commit
be34aa1834
@ -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
|
||||
*
|
||||
|
@ -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':( <et2_readonlysArrayMgr> 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
|
||||
*
|
||||
|
@ -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");
|
||||
|
@ -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":
|
||||
|
Loading…
Reference in New Issue
Block a user