luci-base: luci.js: add optional apply unchecked action
Turn the "Save & Apply" button into a combo button which allows to toggle between apply with rollback and unchecked apply modes. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
3a82faf21a
commit
3b3a1d9cc9
1 changed files with 14 additions and 6 deletions
|
@ -2831,9 +2831,9 @@
|
||||||
* returned promise runs to completion before the button
|
* returned promise runs to completion before the button
|
||||||
* is reenabled.
|
* is reenabled.
|
||||||
*/
|
*/
|
||||||
handleSaveApply: function(ev) {
|
handleSaveApply: function(ev, mode) {
|
||||||
return this.handleSave(ev).then(function() {
|
return this.handleSave(ev).then(function() {
|
||||||
L.ui.changes.apply(true);
|
L.ui.changes.apply(mode == '0');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2905,12 +2905,20 @@
|
||||||
addFooter: function() {
|
addFooter: function() {
|
||||||
var footer = E([]);
|
var footer = E([]);
|
||||||
|
|
||||||
|
var saveApplyBtn = this.handleSaveApply ? new L.ui.ComboButton('0', {
|
||||||
|
0: [ _('Save & Apply') ],
|
||||||
|
1: [ _('Apply unchecked') ]
|
||||||
|
}, {
|
||||||
|
classes: {
|
||||||
|
0: 'cbi-button cbi-button-apply important',
|
||||||
|
1: 'cbi-button cbi-button-negative important'
|
||||||
|
},
|
||||||
|
click: L.ui.createHandlerFn(this, 'handleSaveApply')
|
||||||
|
}).render() : E([]);
|
||||||
|
|
||||||
if (this.handleSaveApply || this.handleSave || this.handleReset) {
|
if (this.handleSaveApply || this.handleSave || this.handleReset) {
|
||||||
footer.appendChild(E('div', { 'class': 'cbi-page-actions' }, [
|
footer.appendChild(E('div', { 'class': 'cbi-page-actions' }, [
|
||||||
this.handleSaveApply ? E('button', {
|
saveApplyBtn, ' ',
|
||||||
'class': 'cbi-button cbi-button-apply',
|
|
||||||
'click': L.ui.createHandlerFn(this, 'handleSaveApply')
|
|
||||||
}, [ _('Save & Apply') ]) : '', ' ',
|
|
||||||
this.handleSave ? 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')
|
||||||
|
|
Loading…
Reference in a new issue