luci-base: ui.js: make "Apply unchecked" available from the changes dialog
authorJo-Philipp Wich <jo@mein.io>
Thu, 5 May 2022 21:50:25 +0000 (23:50 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 6 May 2022 11:42:55 +0000 (13:42 +0200)
Previously, "Apply unchecked" was only possible from the save action of CBI
maps, allow to invoke it from the configuration change dialog as well.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/ui.js

index 52f155b90e89f606c2ce2b61dc26d268765bc10e..a46330f294cefe9f82d3b481efe04561351c3aaa 100644 (file)
@@ -4399,10 +4399,16 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
                                                        'class': 'btn',
                                                        'click': UI.prototype.hideModal
                                                }, [ _('Close') ]), ' ',
-                                               E('button', {
-                                                       'class': 'cbi-button cbi-button-positive important',
-                                                       'click': L.bind(this.apply, this, true)
-                                               }, [ _('Save & Apply') ]), ' ',
+                                               new UIComboButton('0', {
+                                                       0: [ _('Save & Apply') ],
+                                                       1: [ _('Apply unchecked') ]
+                                               }, {
+                                                       classes: {
+                                                               0: 'btn cbi-button cbi-button-positive important',
+                                                               1: 'btn cbi-button cbi-button-negative important'
+                                                       },
+                                                       click: L.bind(function(ev, mode) { this.apply(mode == '0') }, this)
+                                               }).render(), ' ',
                                                E('button', {
                                                        'class': 'cbi-button cbi-button-reset',
                                                        'click': L.bind(this.revert, this)