luci-base: luci.js: render view buttons depending on available functions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2019-09-17 07:03:27 +02:00
parent 96fbca76c8
commit 9ecfe33edd

View file

@ -1337,23 +1337,22 @@
}, },
addFooter: function() { addFooter: function() {
var footer = E([]), var footer = E([]);
mc = document.getElementById('maincontent');
if (mc.querySelector('.cbi-map')) { if (this.handleSaveApply || this.handleSave || this.handleReset) {
footer.appendChild(E('div', { 'class': 'cbi-page-actions' }, [ footer.appendChild(E('div', { 'class': 'cbi-page-actions' }, [
E('button', { this.handleSaveApply ? E('button', {
'class': 'cbi-button cbi-button-apply', 'class': 'cbi-button cbi-button-apply',
'click': L.ui.createHandlerFn(this, 'handleSaveApply') 'click': L.ui.createHandlerFn(this, 'handleSaveApply')
}, _('Save & Apply')), ' ', }, _('Save & Apply')) : '', ' ',
E('button', { this.handleSave ? E('button', {
'class': 'cbi-button cbi-button-save', 'class': 'cbi-button cbi-button-save',
'click': L.ui.createHandlerFn(this, 'handleSave') 'click': L.ui.createHandlerFn(this, 'handleSave')
}, _('Save')), ' ', }, _('Save')) : '', ' ',
E('button', { this.handleReset ? E('button', {
'class': 'cbi-button cbi-button-reset', 'class': 'cbi-button cbi-button-reset',
'click': L.ui.createHandlerFn(this, 'handleReset') 'click': L.ui.createHandlerFn(this, 'handleReset')
}, _('Reset')) }, _('Reset')) : ''
])); ]));
} }