luci-base: move cancel button to the top
authorFlorian Eckert <fe@dev.tdt.de>
Fri, 7 Jun 2024 08:01:31 +0000 (10:01 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 7 Jun 2024 11:33:00 +0000 (13:33 +0200)
This change is required, so that the cancel button is the first and thus
closes the modal when the 'ESC' button is pressed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
modules/luci-base/htdocs/luci-static/resources/ui.js

index d1945a84d87aa1439c97179f3e9c3e5f0c88b60d..9050b10521ff7879164d6a19ca891835688917e4 100644 (file)
@@ -4210,6 +4210,13 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
                        UI.prototype.showModal(_('Uploading file…'), [
                                E('p', _('Please select the file to upload.')),
                                E('div', { 'class': 'right' }, [
+                                       E('div', {
+                                               'class': 'btn cbi-button',
+                                               'click': function() {
+                                                       UI.prototype.hideModal();
+                                                       rejectFn(new Error(_('Upload has been cancelled')));
+                                               }
+                                       }, [ _('Cancel') ]),
                                        E('input', {
                                                type: 'file',
                                                style: 'display:none',
@@ -4239,14 +4246,6 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
                                                        ev.target.previousElementSibling.click();
                                                }
                                        }, [ _('Browse…') ]),
-                                       E('div', {
-                                               'class': 'btn cbi-button',
-                                               'click': function() {
-                                                       UI.prototype.hideModal();
-                                                       rejectFn(new Error(_('Upload has been cancelled')));
-                                               }
-                                       }, [ _('Cancel') ]),
-                                       ' ',
                                        E('div', {
                                                'class': 'btn cbi-button-action important',
                                                'disabled': true,