summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-08-12 19:45:18 +0200
committerJo-Philipp Wich <jo@mein.io>2019-08-14 22:58:15 +0200
commit3b335f2764bfda3f18e13bf492e461977599e411 (patch)
tree9def28745ad364d846f999c30e3410add409ac10 /modules/luci-base/htdocs
parent082fd9ff10be9cd5223bde0b444664eeea5c20ee (diff)
luci-base: form.js: support passing a callback to Map.save()
The given callback function will be executed after the map is parsed, but before the uci is saved. This is useful to add further uci changes before the map is re-rendered. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index 9c5cb9365..44a2df22f 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -132,10 +132,11 @@ var CBIMap = CBINode.extend({
return Promise.all(tasks);
},
- save: function() {
+ save: function(cb) {
this.checkDepends();
return this.parse()
+ .then(cb)
.then(uci.save.bind(uci))
.then(this.load.bind(this))
.then(this.renderContents.bind(this))