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

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



commit 21b15a1ec645707de22bfa2fc297ac898fc29358
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Thu Sep 12 17:48:26 2019 +0200

    Update to breadcrumbs
---
 templates/breadcrumb.html    | 19 ++-----------------
 templates/macros/parent.html | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/templates/breadcrumb.html b/templates/breadcrumb.html
index 56ba19d..40fb3cf 100644
--- a/templates/breadcrumb.html
+++ b/templates/breadcrumb.html
@@ -1,22 +1,7 @@
 <nav aria-label="breadcrumb">
   <ol class="breadcrumb">
-    {% if this.parent %}
-      {% set parent = this.parent %}
-      {% for _ in range(1, 5) %}
-        {% 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 parent = parent.parent %}
-      {% endfor %}
-    {% endif %}
+    {% from "macros/parent.html" import render_parents %}
+    {{ render_parents(this) }}
     <li class="breadcrumb-item active" aria-current="page">{{ this.title }}</li>
   </ol>
 </nav>
diff --git a/templates/macros/parent.html b/templates/macros/parent.html
index e69de29..9625824 100644
--- a/templates/macros/parent.html
+++ b/templates/macros/parent.html
@@ -0,0 +1,19 @@
+{% macro render_parents(item) %}
+  {% 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