diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-19 15:39:46 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-19 15:39:46 +0200 |
commit | 4dfa657f77183c4add96cfd349721be1ca425a49 (patch) | |
tree | 083a2709dd3f98089f0a76d176ff68c21d8896cc /modules/luci-base | |
parent | 53ac685092d62c84cc2add8ae726487b339d9576 (diff) |
luci-base: ui.js: mark user-changed widgets
Set a `data-changed=true` attribute on the widget element when the user
did any change to the default value.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index c0b57528fb..99e1548a43 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -70,6 +70,11 @@ var UIElement = L.Class.extend({ }, setChangeEvents: function(targetNode /*, ... */) { + var tag_changed = L.bind(function(ev) { this.setAttribute('data-changed', true) }, this.node); + + for (var i = 1; i < arguments.length; i++) + targetNode.addEventListener(arguments[i], tag_changed); + this.registerEvents(targetNode, 'widget-change', this.varargs(arguments, 1)); } }); |