luci-base: ui.js: use standard indicator framework to display uci changes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
952b169167
commit
b6e93d54a0
1 changed files with 4 additions and 17 deletions
|
@ -3800,26 +3800,13 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
|
||||||
* The number of changes to indicate.
|
* The number of changes to indicate.
|
||||||
*/
|
*/
|
||||||
setIndicator: function(n) {
|
setIndicator: function(n) {
|
||||||
var i = document.querySelector('.uci_change_indicator');
|
|
||||||
if (i == null) {
|
|
||||||
var poll = document.getElementById('xhr_poll_status');
|
|
||||||
i = poll.parentNode.insertBefore(E('a', {
|
|
||||||
'href': '#',
|
|
||||||
'class': 'uci_change_indicator label notice',
|
|
||||||
'click': L.bind(this.displayChanges, this)
|
|
||||||
}), poll);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
dom.content(i, [ _('Unsaved Changes'), ': ', n ]);
|
UI.prototype.showIndicator('uci-changes',
|
||||||
i.classList.add('flash');
|
'%s: %d'.format(_('Unsaved Changes'), n),
|
||||||
i.style.display = '';
|
L.bind(this.displayChanges, this));
|
||||||
document.dispatchEvent(new CustomEvent('uci-new-changes'));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
i.classList.remove('flash');
|
UI.prototype.hideIndicator('uci-changes');
|
||||||
i.style.display = 'none';
|
|
||||||
document.dispatchEvent(new CustomEvent('uci-clear-changes'));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue