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

hiro at torproject.org hiro at torproject.org
Thu Sep 12 16:09:02 UTC 2019


commit ed618906bb08785075953ae9a47928c7f600207d
Author: hiro <hiro at torproject.org>
Date:   Thu Sep 12 18:09:00 2019 +0200

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

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



More information about the tor-commits mailing list