summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/ui.js16
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 77cef5396..ad1547fee 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) {