diff options
author | Simon Rettberg | 2016-08-10 12:24:01 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-08-10 12:24:01 +0200 |
commit | 0491f5070c2e1c0931aeb74d06cd47101e9fdcd9 (patch) | |
tree | ad80c7a6f7a78ddde6214ac7acc60235e904fd3f /modules-available/baseconfig/templates/_page.html | |
parent | Add fallback feature to Dictionary functions (diff) | |
download | slx-admin-0491f5070c2e1c0931aeb74d06cd47101e9fdcd9.tar.gz slx-admin-0491f5070c2e1c0931aeb74d06cd47101e9fdcd9.tar.xz slx-admin-0491f5070c2e1c0931aeb74d06cd47101e9fdcd9.zip |
[baseconfig] Make shadow definition a json (sub)object; fix some display errors
Diffstat (limited to 'modules-available/baseconfig/templates/_page.html')
-rw-r--r-- | modules-available/baseconfig/templates/_page.html | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/modules-available/baseconfig/templates/_page.html b/modules-available/baseconfig/templates/_page.html index 7bd5f6c9..11b8d8ee 100644 --- a/modules-available/baseconfig/templates/_page.html +++ b/modules-available/baseconfig/templates/_page.html @@ -70,27 +70,27 @@ <script type="text/javascript"> function updateShadows(e) { - var shadowStr = $(e).data('shadows'); + var rules = $(e).data('shadows'); + if (!rules) return; var currentValue = $(e).val(); - var rules = shadowStr.split(','); - rules.forEach(function(rule) { - var rule_parts = rule.split('->'); - var triggerVal = rule_parts[0].trim(); - var target = rule_parts[1].trim(); - var inp = $('#' + target); - var selitem = inp.data('selitem'); - - if (currentValue === triggerVal) { - inp.prop('disabled', true); - if (selitem) selitem.disable(); - $('#' + target + '.multilist').multiselect('disable'); - } else { - inp.prop('disabled', false); - if (selitem) selitem.enable(); - $('#' + target + '.multilist').multiselect('enable'); + for (var triggerVal in rules) { + var targets = rules[triggerVal]; + for (var i = 0; i < targets.length; ++i) { + var target = targets[i]; + var inp = $('#' + target); + var selitem = inp.data('selitem'); + if (currentValue === triggerVal) { + inp.prop('disabled', true); + if (selitem) selitem.disable(); + $('#' + target + '.multilist').multiselect('disable'); + } else { + inp.prop('disabled', false); + if (selitem) selitem.enable(); + $('#' + target + '.multilist').multiselect('enable'); + } } - }); + } } |