summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-09-16 14:38:03 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-09-27 09:48:36 +0200
commit58f295fb1cbc78db91d16708ea15818f29e451b7 (patch)
treec88f22a93799779482a6bd1378748572f74c5b48
parent49db9dc7793e838dd591c5f27eb478656e6d96dc (diff)
Fix client room retrieving
Otherwise, retrieving do not work on clients inside folders.
-rw-r--r--ogcp/static/js/ogcp.js2
-rw-r--r--ogcp/templates/macros.html11
2 files changed, 7 insertions, 6 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js
index 977f5a7..875084d 100644
--- a/ogcp/static/js/ogcp.js
+++ b/ogcp/static/js/ogcp.js
@@ -94,7 +94,7 @@ function checkChildrenCheckboxes() {
others.trigger('change');
} else {
// Look for room, deselect all other rooms
- const selectedRoom = $(this).parent().parent().parent().children('[name="scope-room"]');
+ const selectedRoom = $('[data-room="' + $(this).data('parentRoom') + '"]');
const others = $('input:checkbox[name="scope-room"]').not(selectedRoom);
others.prop('checked', false).prop('indeterminate', false);
others.each(function() {
diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html
index 4ff8477..6ba1d38 100644
--- a/ogcp/templates/macros.html
+++ b/ogcp/templates/macros.html
@@ -1,7 +1,7 @@
{% macro scopes_tree_collapse(scopes, state='', selection_mode='scopes') -%}
<ul id="scopes" class="nav ogcp-nav flex-column nav-pills">
- {{ scopes_tree_collapse_level(scopes["scope"], "", state, selection_mode) }}
+ {{ scopes_tree_collapse_level(scopes["scope"], "", "", state, selection_mode) }}
</ul>
<script>
// Launch the javascript on document ready, so all the global functions exists
@@ -24,7 +24,7 @@
{% endmacro %}
-{% macro scopes_tree_collapse_level(scopes, parent_id, state, selection_mode) -%}
+{% 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">
{% if scope["type"] == "server" %}
@@ -41,14 +41,15 @@
name="scope-center" />
{% endif %}
{% elif scope["type"] == "room" %}
+ {% set parent_room = scope.name + "-" + scope.id|string %}
<input class="form-check-input" type="checkbox" form="scopesForm"
- value="{{ scope["id"] }}"
+ 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 " ".join(scope["ip"]) %}
<input class="form-check-input" type="checkbox" form="scopesForm"
- value="{{ " ".join(scope["ip"]) }}"
+ 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 %}
name="{{ scope["name"] }}_{{ scope["id"] }}" />
@@ -67,7 +68,7 @@
</a>
{% if scope["scope"] %}
<ul class="nav flex-column collapse level{{i}}" id="scope{{parent_id ~ "-" ~ loop.index}}">
- {{ scopes_tree_collapse_level(scope["scope"], parent_id ~ "-" ~ loop.index, state, selection_mode) }}
+ {{ scopes_tree_collapse_level(scope["scope"], parent_room, parent_id ~ "-" ~ loop.index, state, selection_mode) }}
</ul>
{% endif %}
</li>