luci-base: form.js: allow overriding empty section placeholder rendering

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2019-08-08 13:31:47 +02:00
parent a90bf384b2
commit 5628329434

View file

@ -707,6 +707,13 @@ var CBITypedSection = CBIAbstractSection.extend({
return createEl; return createEl;
}, },
renderSectionPlaceholder: function() {
return E([
E('em', _('This section contains no values yet')),
E('br'), E('br')
]);
},
renderContents: function(cfgsections, nodes) { renderContents: function(cfgsections, nodes) {
var section_id = null, var section_id = null,
config_name = this.uciconfig || this.map.config, config_name = this.uciconfig || this.map.config,
@ -749,10 +756,7 @@ var CBITypedSection = CBIAbstractSection.extend({
} }
if (nodes.length == 0) if (nodes.length == 0)
L.dom.append(sectionEl, [ sectionEl.appendChild(this.renderSectionPlaceholder());
E('em', _('This section contains no values yet')),
E('br'), E('br')
]);
sectionEl.appendChild(this.renderSectionAdd()); sectionEl.appendChild(this.renderSectionAdd());