summaryrefslogtreecommitdiffstats
path: root/ogcp/templates/macros.html
diff options
context:
space:
mode:
authorJavier Hernandez <jhernandez@soleta.eu>2024-01-11 13:36:19 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-01-11 13:36:19 +0100
commitcba7a0c1c617e1039055652318c11f309eda932f (patch)
tree0c5424dd702c735f3757a73408a51b21dfc0a65e /ogcp/templates/macros.html
parent2509cacc005832b37e181f6a6a4795f5c7e1fff9 (diff)
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.
Diffstat (limited to 'ogcp/templates/macros.html')
-rw-r--r--ogcp/templates/macros.html14
1 files changed, 8 insertions, 6 deletions
diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html
index e78cb5b..a00556f 100644
--- a/ogcp/templates/macros.html
+++ b/ogcp/templates/macros.html
@@ -17,6 +17,7 @@
checkParentsCheckboxes();
{% elif selection_mode == 'scopes' %}
limitCheckboxes();
+ checkFolderParent();
{% endif %}
}
});
@@ -27,14 +28,15 @@
{% macro scopes_tree_collapse_level(scopes, parent_room, parent_id, state, selection_mode) -%}
{% for scope in scopes %}
<li id="{{ scope["name"]|replace(".", "_")|replace(" ", "_") }}_{{ scope["id"] }}" class="nav-item">
+ {% set input_id = "input" ~ parent_id ~ "-" ~ loop.index %}
{% if scope["type"] == "server" %}
- <input class="form-check-input" type="checkbox" form="scopesForm"
+ <input id="{{ input_id }}" class="form-check-input" type="checkbox" form="scopesForm"
value="{{ scope["server_ip_port"] }}" onclick="return false;"
{% if scope.get("selected", False) %}checked{% endif %}
name="scope-server" hidden/>
{% elif scope["type"] == "center" %}
{% if selection_mode != "commands" %}
- <input class="form-check-input" type="checkbox" form="scopesForm"
+ <input id="{{ input_id }}" class="form-check-input" type="checkbox" form="scopesForm"
value="{{ scope["id"] }}"
{% if state %}style="filter: grayscale(100%);" onclick="return false;"{% endif %}
{% if scope.get("selected", False) %}checked{% endif %}
@@ -42,19 +44,19 @@
{% endif %}
{% elif scope["type"] == "room" %}
{% set parent_room = scope.name + "-" + scope.id|string %}
- <input class="form-check-input" type="checkbox" form="scopesForm"
+ <input id="{{ input_id }}" class="form-check-input" type="checkbox" form="scopesForm"
value="{{ scope["id"] }}" data-room="{{ parent_room }}"
{% if state %}style="filter: grayscale(100%);" onclick="return false;"{% endif %}
{% if scope.get("selected", False) %}checked{% endif %}
name="scope-room" />
{% elif scope["type"] == "folder" %}
- <input class="form-check-input" type="checkbox" form="scopesForm"
- value="{{ scope["id"] }}"
+ <input id="{{ input_id }}" class="form-check-input" type="checkbox" form="scopesForm"
+ value="{{ scope["id"] }}" data-parent-input="{{ "input" ~ parent_id }}"
{% if state %}style="filter: grayscale(100%);" onclick="return false;"{% endif %}
{% if scope.get("selected", False) %}checked{% endif %}
name="folder" />
{% elif " ".join(scope["ip"]) %}
- <input class="form-check-input" type="checkbox" form="scopesForm"
+ <input id="{{ input_id }}" class="form-check-input" type="checkbox" form="scopesForm"
value="{{ " ".join(scope["ip"]) }}" data-parent-room="{{ parent_room }}"
{% if state %}style="filter: grayscale(100%);" onclick="return false;"{% endif %}
{% if scope.get("selected", False) %}checked{% endif %}