From cba7a0c1c617e1039055652318c11f309eda932f Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Thu, 11 Jan 2024 13:36:19 +0100 Subject: views: Add computers to folder Add support for adding computers to a folder. It uses a js script that when selecting a folder in the html form, it will also select the parent of the folder. For instance, if the user were to select a folder that is contained inside a room, the room would also get selected. This allows the view to know which parent contains the folder. --- ogcp/static/js/ogcp.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ogcp/static/js') diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index 964e68d..ccd8a1e 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -374,6 +374,14 @@ function checkRepoServer() { }); } +function checkFolderParent() { + const folder = $('input:checkbox[form|="scopesForm"][name="folder"]') + folder.on('change', function() { + const folder_parent = $('#' + $.escapeSelector(this.dataset.parentInput)); + folder_parent.prop('checked', true); + }); +} + function limitCheckboxes() { const checkboxes = $('input:checkbox[form|="scopesForm"]'); -- cgit v1.2.3-18-g5258