summaryrefslogtreecommitdiffstats
path: root/ogcp/static
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp/static')
-rw-r--r--ogcp/static/js/ogcp.js55
1 files changed, 16 insertions, 39 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js
index f70f77c..96bf3d9 100644
--- a/ogcp/static/js/ogcp.js
+++ b/ogcp/static/js/ogcp.js
@@ -298,41 +298,6 @@ function updateScopes(scopes) {
return hasLiveChildren;
}
-function checkImageServer() {
- const images = $('input:checkbox[form|="imagesForm"][name!="image-server"]')
-
- images.on('change', function() {
- const selectedServer = $('#' + $.escapeSelector(this.dataset.server));
- const serversSelector = 'input:checkbox[name|="image-server"]';
- const nonSelectedServers = $(serversSelector).not(selectedServer);
-
- selectedServer.prop('checked', true);
-
- nonSelectedServers.each(function() {
- $(this).prop('checked', false);
- const checkboxes = $('input:checkbox[data-server|="' + this.id + '"]');
- checkboxes.prop('checked', false);
- });
- });
-}
-
-function checkRepoServer() {
- const repos = $('input:checkbox[form|="reposForm"][name!="repos-server"]')
- repos.on('change', function() {
- const selectedServer = $('#' + $.escapeSelector(this.dataset.server));
- const serversSelector = 'input:checkbox[name|="repos-server"]';
- const nonSelectedServers = $(serversSelector).not(selectedServer);
-
- selectedServer.prop('checked', true);
-
- nonSelectedServers.each(function() {
- $(this).prop('checked', false);
- const checkboxes = $('input:checkbox[data-server|="' + this.id + '"]');
- checkboxes.prop('checked', false);
- });
- });
-}
-
function checkFolderParent(context) {
const folder = $('#sidebar input:checkbox[name="folder"]')
folder.on('change', function() {
@@ -362,7 +327,7 @@ function limitCheckboxes(context) {
}
});
- checkScopeServer();
+ checkCheckbox('scope-server');
checkboxes.each(function() {
storeCheckboxStatus(this, context);
@@ -371,9 +336,9 @@ function limitCheckboxes(context) {
});
}
-function checkScopeServer() {
- const servers = $('#sidebar input:checkbox[name="scope-server"]');
- servers.each(function() {
+function checkCheckbox(inputName) {
+ const checkboxes = $('#sidebar input:checkbox[name="' + inputName + '"]');
+ checkboxes.each(function() {
const checkbox = this;
const checkboxChildren = $('input:checkbox', this.parentNode).not(this);
if (checkboxChildren.length == 0) return;
@@ -382,3 +347,15 @@ function checkScopeServer() {
checkbox.checked = checkedChildren.length > 0;
});
}
+
+function checkOnChange(inputName) {
+ const checkboxes = $('#sidebar input:checkbox')
+
+ checkboxes.on('change', function (event) {
+ checkCheckbox(inputName);
+ });
+
+ checkboxes.each(function () {
+ checkCheckbox(inputName)
+ });
+}