summaryrefslogtreecommitdiffstats
path: root/ogcp/templates
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp/templates')
-rw-r--r--ogcp/templates/commands.html2
-rw-r--r--ogcp/templates/macros.html29
-rw-r--r--ogcp/templates/scopes.html2
3 files changed, 31 insertions, 2 deletions
diff --git a/ogcp/templates/commands.html b/ogcp/templates/commands.html
index 27af1b1..1e7dc84 100644
--- a/ogcp/templates/commands.html
+++ b/ogcp/templates/commands.html
@@ -12,7 +12,7 @@
{% endblock %}
{% block sidebar %}
- {{ macros.print_scopes_tree(scopes["scope"]) }}
+ {{ macros.scopes_tree_collapse(scopes) }}
{% endblock %}
{% block commands %}
diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html
index 3bde877..60b26a7 100644
--- a/ogcp/templates/macros.html
+++ b/ogcp/templates/macros.html
@@ -18,3 +18,32 @@
{% endmacro %}
+{% macro scopes_tree_collapse(scopes) -%}
+
+<ul class="nav flex-column nav-pills">
+ {{ scopes_tree_collapse_level(scopes["scope"], 1) }}
+</ul>
+
+{% endmacro %}
+
+{% macro scopes_tree_collapse_level(scopes, i) -%}
+{% for scope in scopes %}
+<li class="nav-item {% if scope["state"] %}state--{{scope["state"] | lower}}{% endif %}">
+ {% if " ".join(scope["ip"]) %}
+ <input class="form-check-input" type="checkbox" form="scopesForm"
+ value="{{ " ".join(scope["ip"]) }}"
+ {% if scope.get("selected", False) %}checked{% endif %}
+ name="{{ scope["name"] }}_{{ scope["id"] }}" />
+ {% endif %}
+ <a class="nav-link {% if not scope["scope"] %}disabled{% endif %}" href="#level{{i}}-{{loop.index}}"
+ {% if scope["scope"] %}data-toggle="collapse"{% endif %}>
+ {{ scope["name"] }}
+ </a>
+ {% if scope["scope"] %}
+ <ul class="nav flex-column collapse level{{i}}" id="level{{i}}-{{loop.index}}">
+ {{ scopes_tree_collapse_level(scope["scope"], i + 1) }}
+ </ul>
+ {% endif %}
+ </li>
+{% endfor %}
+{% endmacro %}
diff --git a/ogcp/templates/scopes.html b/ogcp/templates/scopes.html
index 1d931bb..746acff 100644
--- a/ogcp/templates/scopes.html
+++ b/ogcp/templates/scopes.html
@@ -12,7 +12,7 @@
{% endblock %}
{% block sidebar %}
- {{ macros.print_scopes_tree(scopes["scope"]) }}
+ {{ macros.scopes_tree_collapse(scopes) }}
{% endblock %}
{% block commands %}