summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-04-05 11:52:34 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-04-08 08:03:10 +0200
commit1120b31e3838f3c7806df83cdeaab6a02b95eca6 (patch)
treed6f520694cd2a541ebf6d636be9f7d2d44a5a714
parente5087d2cfd31d47ef384e1948eee6fa1d85c47be (diff)
Simplify scope identifiers
Old id format example: id_1-1_2-4_3-2 New id format example: scope-1-4-2 It represents the node and its ancestors' position with respect to theirs siblings. The rightmost value is the current node position. Commit f70d90ba32a6 introduces the old format.
-rw-r--r--ogcp/templates/macros.html10
1 files changed, 5 insertions, 5 deletions
diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html
index e91a2ef..6f19a30 100644
--- a/ogcp/templates/macros.html
+++ b/ogcp/templates/macros.html
@@ -1,7 +1,7 @@
{% macro scopes_tree_collapse(scopes, state='') -%}
<ul id="scopes" class="nav flex-column nav-pills">
- {{ scopes_tree_collapse_level(scopes["scope"], 1, "", state) }}
+ {{ scopes_tree_collapse_level(scopes["scope"], "", state) }}
</ul>
<script>
// Launch the javascript on document ready, so all the global functions exists
@@ -19,7 +19,7 @@
{% endmacro %}
-{% macro scopes_tree_collapse_level(scopes, i, parent_id, state) -%}
+{% macro scopes_tree_collapse_level(scopes, parent_id, state) -%}
{% for scope in scopes %}
<li id="{{ scope["name"]|replace(".", "_")|replace(" ", "_") }}_{{ scope["id"] }}" class="nav-item">
{% if " ".join(scope["ip"]) %}
@@ -29,7 +29,7 @@
{% if scope.get("selected", False) %}checked{% endif %}
name="{{ scope["name"] }}_{{ scope["id"] }}" />
{% endif %}
- <a class="nav-link {% if not scope["scope"] %}disabled{% endif %}" href="#id{{parent_id ~ "_" ~ i ~ "-" ~ loop.index}}"
+ <a class="nav-link {% if not scope["scope"] %}disabled{% endif %}" href="#scope{{parent_id ~ "-" ~ loop.index}}"
{% if scope["scope"] %}data-toggle="collapse"{% endif %}>
{% if "state" in scope %}
<i class="nav-icon fa-circle
@@ -42,8 +42,8 @@
{{ scope["name"] }}
</a>
{% if scope["scope"] %}
- <ul class="nav flex-column collapse level{{i}}" id="id{{parent_id ~ "_" ~ i ~ "-" ~ loop.index}}">
- {{ scopes_tree_collapse_level(scope["scope"], i + 1, parent_id ~ "_" ~ i ~ "-" ~ loop.index, state) }}
+ <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) }}
</ul>
{% endif %}
</li>