luci-base: form.js: add modal dialog hook
authorJo-Philipp Wich <jo@mein.io>
Wed, 31 Jul 2019 06:00:29 +0000 (08:00 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 1 Aug 2019 14:48:50 +0000 (16:48 +0200)
Add a new `addModalOptions()` hook which allows to supply additional
cbi options the modal map before the dialog is rendered.

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

index 82b7695e45dd3aae8790965fb4b6c4bfc5af854e..ab0998943ce6d3351496fb5511baee352870337e 100644 (file)
@@ -1067,6 +1067,10 @@ var CBITableSection = CBITypedSection.extend({
                        .catch(function() {});
        },
 
+       addModalOptions: function(modalSection, section_id, ev) {
+
+       },
+
        renderMoreOptionsModal: function(section_id, ev) {
                var parent = this.map,
                    title = parent.title,
@@ -1111,7 +1115,7 @@ var CBITableSection = CBITypedSection.extend({
                }
 
                //ev.target.classList.add('spinning');
-               m.render().then(L.bind(function(nodes) {
+               Promise.resolve(this.addModalOptions(s, section_id, ev)).then(L.bind(m.render, m)).then(L.bind(function(nodes) {
                        //ev.target.classList.remove('spinning');
                        L.ui.showModal(title, [
                                nodes,