Merge pull request #4770 from nickberry17/update_DummyValue

luci-base: add new member 'hidden' to DummyValue
This commit is contained in:
Jo-Philipp Wich 2021-06-02 08:23:45 +02:00 committed by GitHub
commit 1255c4832e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3954,11 +3954,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 }));