From 867fcc17c6869b10346e30e14c2b0b898a6c9429 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 26 Jan 2021 10:42:18 -0700 Subject: [PATCH] Etemplate: Allow to specify the read only true/false values for checkbox customfields --- api/js/etemplate/et2_extension_customfields.js | 8 +++++++- api/js/etemplate/et2_extension_customfields.ts | 10 +++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_extension_customfields.js b/api/js/etemplate/et2_extension_customfields.js index 89ae9184d1..6d27bd4a28 100644 --- a/api/js/etemplate/et2_extension_customfields.js +++ b/api/js/etemplate/et2_extension_customfields.js @@ -439,9 +439,15 @@ var et2_customfields_list = /** @class */ (function (_super) { }; et2_customfields_list.prototype._setup_checkbox = function (field_name, field, attrs) { // Read-only checkbox is just text - if (attrs.readonly) { + if (attrs.readonly && this.getType() !== "customfields") { 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; }; /** diff --git a/api/js/etemplate/et2_extension_customfields.ts b/api/js/etemplate/et2_extension_customfields.ts index 2d1a8f0ac7..4acea52451 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -599,10 +599,18 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac _setup_checkbox( field_name, field, attrs) { // Read-only checkbox is just text - if(attrs.readonly) + if(attrs.readonly && this.getType() !== "customfields") { 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; }