mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
If customfields has a label and only 1 field, use the label for the widget
This lets us use " " as label to hide the custom field's label
This commit is contained in:
parent
649b0bfd59
commit
85cc2a33cd
@ -276,9 +276,10 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Label in first column, widget in 2nd
|
// Label in first column, widget in 2nd
|
||||||
|
const label = this.options.label || field.label;
|
||||||
jQuery(document.createElement("td"))
|
jQuery(document.createElement("td"))
|
||||||
.prependTo(row);
|
.prependTo(row);
|
||||||
et2_createWidget("label",{id: id + "_label", value: field.label,for: id},this);
|
et2_createWidget("label", {id: id + "_label", value: label.trim(), for: id}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = attrs.type ? attrs.type : field.type;
|
const type = attrs.type ? attrs.type : field.type;
|
||||||
@ -420,7 +421,7 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadFromXML( _node)
|
loadFromXML(_node)
|
||||||
{
|
{
|
||||||
this.loadFields();
|
this.loadFields();
|
||||||
|
|
||||||
@ -428,6 +429,17 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
|
|||||||
super.loadFromXML(_node);
|
super.loadFromXML(_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_label(_value : string)
|
||||||
|
{
|
||||||
|
// If we've got a field list, or all fields use normal label
|
||||||
|
if(this.getType() == 'customfields-list' || jQuery.isEmptyObject(this.options.fields) ||
|
||||||
|
Object.keys(this.options.fields).filter(f => this.options.fields[f]).length != 1)
|
||||||
|
{
|
||||||
|
return super.set_label(_value);
|
||||||
|
}
|
||||||
|
// For single field, we apply the widget label to the single field
|
||||||
|
}
|
||||||
|
|
||||||
set_value( _value)
|
set_value( _value)
|
||||||
{
|
{
|
||||||
if(!this.options.customfields) return;
|
if(!this.options.customfields) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user