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>
This commit is contained in:
Jo-Philipp Wich 2019-09-19 15:39:46 +02:00
parent 53ac685092
commit 4dfa657f77

View file

@ -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));
}
});