diff options
Diffstat (limited to 'ogcp/static/js/ogcp.js')
-rw-r--r-- | ogcp/static/js/ogcp.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index 5c15b30..b57fca7 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -399,8 +399,21 @@ function limitCheckboxes(context) { const checkboxes = $('input:checkbox[form|="scopesForm"]'); checkboxes.on('change', function () { - const checked = this; - checkboxes.filter((i, c) => c !== checked).prop('checked', false); + const currentCheckbox = $(this); + const currentParentRoom = currentCheckbox.attr('data-parent-room'); + + checkboxes.each(function () { + const checkbox = $(this); + const checkboxParentRoom = checkbox.attr('data-parent-room'); + + if (currentCheckbox.is(checkbox)) { + return; + } + const isSibling = currentParentRoom && checkboxParentRoom && checkboxParentRoom === currentParentRoom; + if (!isSibling) { + checkbox.prop('checked', false); + } + }); checkScopeServer(); |