luci-base: {ui,form}.js: allow passing additional CSS classes to modals
authorJo-Philipp Wich <jo@mein.io>
Thu, 13 Jun 2019 13:01:00 +0000 (15:01 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 7 Jul 2019 13:36:26 +0000 (15:36 +0200)
Add the ability to pass additional CSS classes to modal dialogs and
make use of this facility in form.js to annotate CBI map modals.

This can be used later by themes to apply additional CSS rules.

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

index a1bfbdc2b265f0609e4a9a2ab979554f0dac436d..8bb0da4a40fd18d319b3e6c34b73ebec9bc8451a 100644 (file)
@@ -1126,7 +1126,7 @@ var CBITableSection = CBITypedSection.extend({
                                                'value': _('Save')
                                        })
                                ])
-                       ]);
+                       ], 'cbi-modal');
                }, this)).catch(L.error);
        }
 });
index c51d651e9e7b8e0b6af57dd8a6449b2dde36d5ed..28d1fa90ae0b8706d7d4820055021e8a5982e256 100644 (file)
@@ -1414,11 +1414,14 @@ return L.Class.extend({
        },
 
        /* Modal dialog */
-       showModal: function(title, children) {
+       showModal: function(title, children /* , ... */) {
                var dlg = modalDiv.firstElementChild;
 
                dlg.setAttribute('class', 'modal');
 
+               for (var i = 2; i < arguments.length; i++)
+                       dlg.classList.add(arguments[i]);
+
                L.dom.content(dlg, L.dom.create('h4', {}, title));
                L.dom.append(dlg, children);