From: Jo-Philipp Wich Date: Thu, 13 Jun 2019 13:01:00 +0000 (+0200) Subject: luci-base: {ui,form}.js: allow passing additional CSS classes to modals X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=dc2b38cb6f44331b686caa8280dbde0b13c0d45d;p=openwrt-luci.git luci-base: {ui,form}.js: allow passing additional CSS classes to modals 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 --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index a1bfbdc2b2..8bb0da4a40 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -1126,7 +1126,7 @@ var CBITableSection = CBITypedSection.extend({ 'value': _('Save') }) ]) - ]); + ], 'cbi-modal'); }, this)).catch(L.error); } }); diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index c51d651e9e..28d1fa90ae 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -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);