From dc2b38cb6f44331b686caa8280dbde0b13c0d45d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 13 Jun 2019 15:01:00 +0200 Subject: [PATCH] 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 --- modules/luci-base/htdocs/luci-static/resources/form.js | 2 +- modules/luci-base/htdocs/luci-static/resources/ui.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index a1bfbdc2b..8bb0da4a4 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 c51d651e9..28d1fa90a 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); -- 2.25.1