Etemplate: Allow to specify the read only true/false values for checkbox customfields

This commit is contained in:
nathangray 2021-01-26 10:42:18 -07:00
parent dad82bf1f1
commit 867fcc17c6
2 changed files with 16 additions and 2 deletions

View File

@ -439,9 +439,15 @@ var et2_customfields_list = /** @class */ (function (_super) {
}; };
et2_customfields_list.prototype._setup_checkbox = function (field_name, field, attrs) { et2_customfields_list.prototype._setup_checkbox = function (field_name, field, attrs) {
// Read-only checkbox is just text // Read-only checkbox is just text
if (attrs.readonly) { if (attrs.readonly && this.getType() !== "customfields") {
attrs.ro_true = field.label; attrs.ro_true = field.label;
} }
else if (field.hasOwnProperty('ro_true')) {
attrs.ro_true = field.ro_true;
}
if (field.hasOwnProperty('ro_false')) {
attrs.ro_false = field.ro_false;
}
return true; return true;
}; };
/** /**

View File

@ -599,10 +599,18 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
_setup_checkbox( field_name, field, attrs) _setup_checkbox( field_name, field, attrs)
{ {
// Read-only checkbox is just text // Read-only checkbox is just text
if(attrs.readonly) if(attrs.readonly && this.getType() !== "customfields")
{ {
attrs.ro_true = field.label; attrs.ro_true = field.label;
} }
else if (field.hasOwnProperty('ro_true'))
{
attrs.ro_true = field.ro_true;
}
if (field.hasOwnProperty('ro_false'))
{
attrs.ro_false = field.ro_false;
}
return true; return true;
} }