[tor-commits] [lego/master] Update to breadcrumbs

hiro at torproject.org hiro at torproject.org
Thu Sep 12 16:15:47 UTC 2019


commit ae8465f4a3508e847e4a3209791f9bf7e1abb5b8
Author: hiro <hiro at torproject.org>
Date:   Thu Sep 12 18:15:44 2019 +0200

    Update to breadcrumbs
---
 templates/macros/parent.html | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/templates/macros/parent.html b/templates/macros/parent.html
index 1db15e4..30d7ed7 100644
--- a/templates/macros/parent.html
+++ b/templates/macros/parent.html
@@ -1,20 +1,25 @@
+{% macro render_parent(item) %}
+  <li class="breadcrumb-item active" aria-current="page">
+    <a href="{{ vars.parent.path|url }}">
+      {{ item.parent.title }}
+    </a>
+  </li>
+{% endmacro %}
+
 {% macro render_parents(item) %}
-  {% set vars = {'parent': item.parent, 'item': item } %}
   {% if item.parent %}
-    {% for _ in range(1, 5) %}
-      {% if vars.update({'parent': item.parent}) %} {% endif %}
-      {% if vars.parent %}
-        {% if vars.parent.path == "/" %}
-          {# break #}
-        {% else %}
-          <li class="breadcrumb-item active" aria-current="page">
-            <a href="{{ vars.parent.path|url }}">
-              {{ vars.parent.title }}
-            </a>
-          </li>
+    {{ render_parent(item) }}
+    {% set item = item.parent %}
+    {% if item.parent %}
+      {{ render_parent(item) }}
+      {% set item = item.parent %}
+      {% if item.parent %}
+        {{ render_parent(item) }}
+        {% set item = item.parent %}
+        {% if item.parent %}
+          {{ render_parent(item) }}
         {% endif %}
       {% endif %}
-      {% if vars.update({'item': vars.parent}) %} {% endif %}
-    {% endfor %}
+    {% endif %}
   {% endif %}
 {% endmacro %}



More information about the tor-commits mailing list