luci-base: add new member 'hidden' to DummyValue

Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
(cherry picked from commit 936dde7422)
This commit is contained in:
Nicholas Smith 2021-02-06 11:12:36 +10:00 committed by Jo-Philipp Wich
parent 39280c3703
commit d2a9284836

View file

@ -3932,11 +3932,21 @@ var CBIDummyValue = CBIValue.extend(/** @lends LuCI.form.DummyValue.prototype */
* @default null
*/
/**
* Render the UCI option value as hidden using the HTML display: none style property.
*
* By default, the value is displayed
*
* @name LuCI.form.DummyValue.prototype#hidden
* @type boolean
* @default null
*/
/** @private */
renderWidget: function(section_id, option_index, cfgvalue) {
var value = (cfgvalue != null) ? cfgvalue : this.default,
hiddenEl = new ui.Hiddenfield(value, { id: this.cbid(section_id) }),
outputEl = E('div');
outputEl = E('div', { 'style': this.hidden ? 'display:none' : null });
if (this.href && !((this.readonly != null) ? this.readonly : this.map.readonly))
outputEl.appendChild(E('a', { 'href': this.href }));