summaryrefslogtreecommitdiffstats
path: root/ogcp/static
diff options
context:
space:
mode:
authorDaniel García Moreno <danigm@soleta.eu>2022-09-13 13:02:36 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-09-27 09:48:36 +0200
commitea182079989407e382917d95cc86c77dbee7bff8 (patch)
treed7dab24c242a9c19da021cdc46efc8273e259d6f /ogcp/static
parentefe97317534942c97bfbc132e096655b8191105f (diff)
Implement single room selection for commands view
Diffstat (limited to 'ogcp/static')
-rw-r--r--ogcp/static/js/ogcp.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js
index e72bc83..ac796b1 100644
--- a/ogcp/static/js/ogcp.js
+++ b/ogcp/static/js/ogcp.js
@@ -85,6 +85,26 @@ function checkChildrenCheckboxes() {
checkboxes.on('change', function () {
const checked = this.checked
const children = $('input:checkbox', this.parentNode).not(this)
+
+ if (checked) {
+ // Only for rooms, deselect other rooms
+ if (this.name === 'scope-room') {
+ const others = $('input:checkbox[form|="scopesForm"]').not(this);
+ others.prop('checked', false);
+ others.trigger('change');
+ } else {
+ // Look for room, deselect all other rooms
+ const selectedRoom = $(this).parent().parent().parent().children('[name="scope-room"]');
+ const others = $('input:checkbox[name="scope-room"]').not(selectedRoom);
+ others.prop('checked', false).prop('indeterminate', false);
+ others.each(function() {
+ const checks = $(this).parent().find('input:checkbox').prop('checked', false);
+ checks.trigger('change');
+ });
+ others.trigger('change');
+ }
+ }
+
children.each(function () {
this.checked = checked;
storeCheckboxStatus(this);
@@ -272,7 +292,7 @@ function limitCheckboxes() {
checkboxes.on('change', function () {
const checked = this;
checkboxes.filter((i, c) => c !== checked).prop('checked', false);
- checkboxes.each(function() {
+ checkboxes.not('[name="scope-server"]').each(function() {
showSelectedClient(this);
});
checkScopeServer();