diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-07-22 08:40:38 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-07-22 08:40:38 +0200 |
commit | d1841af2f04710644133c12a4c8ee1aeaaf2f7d9 (patch) | |
tree | b3f712144f42eda807f2223eb37c99ee49769095 /modules/luci-base/htdocs/luci-static | |
parent | 0be4ad51a0bea3e1e3e6cd7d646e11ec6c722540 (diff) |
luci-base: widgets.js: CBIZoneSelect: fix availability of "device" choice
Ref: https://github.com/openwrt/luci/issues/2889
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/tools/widgets.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/tools/widgets.js b/modules/luci-base/htdocs/luci-static/resources/tools/widgets.js index 90e2512a6..e79cb2aef 100644 --- a/modules/luci-base/htdocs/luci-static/resources/tools/widgets.js +++ b/modules/luci-base/htdocs/luci-static/resources/tools/widgets.js @@ -150,11 +150,14 @@ var CBIZoneSelect = form.ListValue.extend({ } else { var anyval = node.querySelector('[data-value="*"]'), - emptyval = node.querySelector('[data-value=""]') || anyval.cloneNode(true); + emptyval = node.querySelector('[data-value=""]'); - emptyval.removeAttribute('display'); - emptyval.removeAttribute('selected'); - emptyval.setAttribute('data-value', ''); + if (emptyval == null) { + emptyval = anyval.cloneNode(true); + emptyval.removeAttribute('display'); + emptyval.removeAttribute('selected'); + emptyval.setAttribute('data-value', ''); + } L.dom.content(emptyval.querySelector('span'), [ E('strong', _('Device')), ' (%s)'.format(_('input')) @@ -171,8 +174,9 @@ var CBIZoneSelect = form.ListValue.extend({ } else if (this.option == 'dest') { for (var i = 0; i < this.section.children.length; i++) { - if (this.section.children[i].option == 'src') { - if (!this.section.children[i].cfgvalue(section_id)) { + var opt = this.section.children[i]; + if (opt.option == 'src') { + if (!opt.cfgvalue(section_id) && !opt.default) { var emptyval = elem.querySelector('[data-value=""]'); if (emptyval != null) |