[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit d88cb2192648457ba42a8c91c762e3be7d0b89d0
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Thu Sep 12 17:59:04 2019 +0200

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

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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits