diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-08-20 13:33:08 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-10 15:28:16 +0200 |
commit | 3500562d5e3fbfb4530059baed2300bfaa1e757f (patch) | |
tree | df7d328a80948ca4ed287d8aa32795cd80db3dbd /modules/luci-base/htdocs/luci-static/resources | |
parent | 6b1003cd503d41fd8d533c353fb7a6298bdcc71f (diff) |
luci-base: ui.js: ignore description when checking for empty tab panes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 77cef53964..ad1547fee2 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -1628,7 +1628,7 @@ return L.Class.extend({ active = pane.getAttribute('data-tab-active') === 'true'; menu.appendChild(E('li', { - 'style': L.dom.isEmpty(pane) ? 'display:none' : null, + 'style': this.isEmptyPane(pane) ? 'display:none' : null, 'class': active ? 'cbi-tab' : 'cbi-tab-disabled', 'data-tab': name }, E('a', { @@ -1645,9 +1645,9 @@ return L.Class.extend({ if (selected === null) { selected = this.getActiveTabId(panes[0]); - if (selected < 0 || selected >= panes.length || L.dom.isEmpty(panes[selected])) { + if (selected < 0 || selected >= panes.length || this.isEmptyPane(panes[selected])) { for (var i = 0; i < panes.length; i++) { - if (!L.dom.isEmpty(panes[i])) { + if (!this.isEmptyPane(panes[i])) { selected = i; break; } @@ -1662,6 +1662,10 @@ return L.Class.extend({ } }, + isEmptyPane: function(pane) { + return L.dom.isEmpty(pane, function(n) { return n.classList.contains('cbi-tab-descr') }); + }, + getPathForPane: function(pane) { var path = [], node = null; @@ -1712,7 +1716,7 @@ return L.Class.extend({ }, updateTabs: function(ev, root) { - (root || document).querySelectorAll('[data-tab-title]').forEach(function(pane) { + (root || document).querySelectorAll('[data-tab-title]').forEach(L.bind(function(pane) { var menu = pane.parentNode.previousElementSibling, tab = menu ? menu.querySelector('[data-tab="%s"]'.format(pane.getAttribute('data-tab'))) : null, n_errors = pane.querySelectorAll('.cbi-input-invalid').length; @@ -1720,7 +1724,7 @@ return L.Class.extend({ if (!menu || !tab) return; - if (L.dom.isEmpty(pane)) { + if (this.isEmptyPane(pane)) { tab.style.display = 'none'; tab.classList.remove('flash'); } @@ -1738,7 +1742,7 @@ return L.Class.extend({ tab.removeAttribute('data-errors'); tab.removeAttribute('data-tooltip'); } - }); + }, this)); }, switchTab: function(ev) { |