diff options
author | Florian Eckert <fe@dev.tdt.de> | 2021-10-28 15:47:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 15:47:44 +0200 |
commit | b710c4a843d742b89b0d4df1fc730a5362d382b1 (patch) | |
tree | 9d9952516876dff448ea5442892ff65938c2ad2c /modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js | |
parent | ad360ec00a3667d530fa1a911ac19515b132d588 (diff) | |
parent | 5b42cd5b46c32bf168b7156602bfa0ba841904a1 (diff) |
Merge pull request #5328 from TDT-AG/pr/20210903-luci-mod-system
luci-mod-system: add led-trigger description
Diffstat (limited to 'modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js')
-rw-r--r-- | modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js index 23feebc005..c0cbd7a4f1 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/leds.js @@ -63,6 +63,7 @@ return view.extend({ s.addremove = true; s.sortable = true; s.addbtntitle = _('Add LED action'); + s.nodescriptions = true; s.option(form.Value, 'name', _('Name')); @@ -75,13 +76,31 @@ return view.extend({ for (var i = 0; i < plugins.length; i++) { var plugin = plugins[i]; - if ( plugin.form.kernel == false ) + if ( plugin.form.kernel == false ) { o.value(plugin.name, plugin.form.trigger); - else - for (var k = 0; k < triggers.length; k++) - if ( plugin.name == triggers[k] ) - o.value(plugin.name, plugin.form.trigger); + } + else { + if (triggers.indexOf(plugin.name) >= 0) + o.value(plugin.name, plugin.form.trigger); + } + } + o.onchange = function(ev, section, value) { + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if ( plugin.name === value ) + this.map.findElement('id', 'cbid.system.%s.trigger'.format(section)) + .nextElementSibling.innerHTML = plugin.form.description || ''; + } } + o.load = function(section_id) { + var trigger = uci.get('system', section_id, 'trigger'); + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if ( plugin.name === trigger) + this.description = plugin.form.description || ''; + } + return trigger; + }; s.addModalOptions = function(s) { for (var i = 0; i < plugins.length; i++) { |