From 2ca2215ed6653dc7bf2cfaf320fee811b376ece8 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 16 Sep 2024 13:46:28 +0200 Subject: js: restrict the checkbox filter to the sidebar Prevent accidental processing of checkboxes outside the sidebar. --- ogcp/static/js/ogcp.js | 12 ++++++------ ogcp/templates/base.html | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index 4136df6..f70f77c 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -47,7 +47,7 @@ function showSelectedClient(client_checkbox) { } function showSelectedClientsOnEvents() { - const checkboxes = $('input:checkbox[form|="scopesForm"]'); + const checkboxes = $('#sidebar input:checkbox'); checkboxes.on('change show-client', function () { showSelectedClient(this); @@ -111,7 +111,7 @@ function configureCommandCheckboxes(context) { checkboxes.on('change', function () { const checked = this.checked; - const childrenCheckboxes = $('input:checkbox[form|="scopesForm"]', this.parentNode); + const childrenCheckboxes = $('#sidebar input:checkbox', this.parentNode); // Uncheck all other checkboxes outside of the actual center branch if (checked) { @@ -138,7 +138,7 @@ function configureCommandCheckboxes(context) { } function keepSelectedClients(context) { - const checkboxes = $('input:checkbox[form|="scopesForm"]') + const checkboxes = $('#sidebar input:checkbox') checkboxes.on('change', function (event) { storeCheckboxStatus(this, context); @@ -334,7 +334,7 @@ function checkRepoServer() { } function checkFolderParent(context) { - const folder = $('input:checkbox[form|="scopesForm"][name="folder"]') + const folder = $('#sidebar input:checkbox[name="folder"]') folder.on('change', function() { const folder_parent = $('#' + $.escapeSelector(this.dataset.parentInput)); folder_parent.prop('checked', this.checked); @@ -343,7 +343,7 @@ function checkFolderParent(context) { } function limitCheckboxes(context) { - const checkboxes = $('input:checkbox[form|="scopesForm"]'); + const checkboxes = $('#sidebar input:checkbox'); checkboxes.on('change', function () { const currentCheckbox = $(this); @@ -372,7 +372,7 @@ function limitCheckboxes(context) { } function checkScopeServer() { - const servers = $('input:checkbox[form|="scopesForm"][name="scope-server"]'); + const servers = $('#sidebar input:checkbox[name="scope-server"]'); servers.each(function() { const checkbox = this; const checkboxChildren = $('input:checkbox', this.parentNode).not(this); diff --git a/ogcp/templates/base.html b/ogcp/templates/base.html index 798674b..9c6b3e1 100644 --- a/ogcp/templates/base.html +++ b/ogcp/templates/base.html @@ -111,7 +111,7 @@ - +