luci-base: form.js: rendering fixes for grid sections
- Ensure that last header cell is rendered for grid sections without sorting or addremove actions - Don't skip header cells for optional options Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
bf774e4c2a
commit
9bb78b5cd8
1 changed files with 9 additions and 5 deletions
|
@ -1104,7 +1104,7 @@ var CBITableSection = CBITypedSection.extend({
|
||||||
return sectionEl;
|
return sectionEl;
|
||||||
},
|
},
|
||||||
|
|
||||||
renderHeaderRows: function(max_cols) {
|
renderHeaderRows: function(max_cols, has_action) {
|
||||||
var has_titles = false,
|
var has_titles = false,
|
||||||
has_descriptions = false,
|
has_descriptions = false,
|
||||||
max_cols = isNaN(this.max_cols) ? this.children.length : this.max_cols,
|
max_cols = isNaN(this.max_cols) ? this.children.length : this.max_cols,
|
||||||
|
@ -1113,7 +1113,7 @@ var CBITableSection = CBITypedSection.extend({
|
||||||
trEls = E([]);
|
trEls = E([]);
|
||||||
|
|
||||||
for (var i = 0, opt; i < max_cols && (opt = this.children[i]) != null; i++) {
|
for (var i = 0, opt; i < max_cols && (opt = this.children[i]) != null; i++) {
|
||||||
if (opt.optional || opt.modalonly)
|
if (opt.modalonly)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
has_titles = has_titles || !!opt.title;
|
has_titles = has_titles || !!opt.title;
|
||||||
|
@ -1127,7 +1127,7 @@ var CBITableSection = CBITypedSection.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var i = 0, opt; i < max_cols && (opt = this.children[i]) != null; i++) {
|
for (var i = 0, opt; i < max_cols && (opt = this.children[i]) != null; i++) {
|
||||||
if (opt.optional || opt.modalonly)
|
if (opt.modalonly)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
trEl.appendChild(E('div', {
|
trEl.appendChild(E('div', {
|
||||||
|
@ -1149,7 +1149,7 @@ var CBITableSection = CBITypedSection.extend({
|
||||||
L.dom.content(trEl.lastElementChild, opt.title);
|
L.dom.content(trEl.lastElementChild, opt.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.sortable || this.extedit || this.addremove || has_more)
|
if (this.sortable || this.extedit || this.addremove || has_more || has_action)
|
||||||
trEl.appendChild(E('div', {
|
trEl.appendChild(E('div', {
|
||||||
'class': 'th cbi-section-table-cell cbi-section-actions'
|
'class': 'th cbi-section-table-cell cbi-section-actions'
|
||||||
}));
|
}));
|
||||||
|
@ -1163,7 +1163,7 @@ var CBITableSection = CBITypedSection.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var i = 0, opt; i < max_cols && (opt = this.children[i]) != null; i++) {
|
for (var i = 0, opt; i < max_cols && (opt = this.children[i]) != null; i++) {
|
||||||
if (opt.optional || opt.modalonly)
|
if (opt.modalonly)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
trEl.appendChild(E('div', {
|
trEl.appendChild(E('div', {
|
||||||
|
@ -1477,6 +1477,10 @@ var CBIGridSection = CBITableSection.extend({
|
||||||
}, (value != null) ? value : E('em', _('none')));
|
}, (value != null) ? value : E('em', _('none')));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renderHeaderRows: function(section_id) {
|
||||||
|
return this.super('renderHeaderRows', [ NaN, true ]);
|
||||||
|
},
|
||||||
|
|
||||||
renderRowActions: function(section_id) {
|
renderRowActions: function(section_id) {
|
||||||
return this.super('renderRowActions', [ section_id, _('Edit') ]);
|
return this.super('renderRowActions', [ section_id, _('Edit') ]);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue