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 <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2019-06-13 15:01:00 +02:00
parent 1605f29b6f
commit dc2b38cb6f
2 changed files with 5 additions and 2 deletions

View file

@ -1126,7 +1126,7 @@ var CBITableSection = CBITypedSection.extend({
'value': _('Save')
})
])
]);
], 'cbi-modal');
}, this)).catch(L.error);
}
});

View 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);