]> git.parisson.com Git - mezzo.git/commitdiff
Menu with no children
authorEmilie <zawadzki@ircam.fr>
Mon, 7 Nov 2016 17:10:11 +0000 (18:10 +0100)
committerEmilie <zawadzki@ircam.fr>
Mon, 7 Nov 2016 17:10:11 +0000 (18:10 +0100)
app/templates/pages/menus/current_tree_primary.html

index 7ebe41c508087ff60ae76327013a16da21fc46c6..3bddf3df6d198531b0197d869474222715fd00d7 100644 (file)
@@ -2,54 +2,58 @@
 
 {% spaceless %}
 {% if page_branch_in_menu %}
-    {% if branch_level == 0 %}
-        {% for page in page_branch %}
-            {% if page.in_menu and page.has_children_in_menu %}
-                {% if page.is_primary and page.is_current_or_ascendant %}
-                <ul class="nav-tree nav-tree--level-{{ branch_level }}" data-sticky data-sticky-parent="page" data-sticky-offset="100" data-sticky-detach-at="971">
-                    <li class="nav-tree__item">
-                        <a class="nav-tree__link{% if page.is_current %} active{% endif %}" href="{{ page.get_absolute_url }}">{% trans 'Accueil' %}</a>
-                    </li>
-                {% endif %}
-                {% if page.is_current_or_ascendant %}
-                    {% if page.has_children_in_menu %}
-                        {% page_menu page %}
+    {% with page as current_page %}
+        {% if branch_level == 0 %}
+            {% for page in page_branch %}
+                {% if page.in_menu and page.has_children_in_menu %}
+                    {% if page.is_primary and page.is_current_or_ascendant %}
+                    <ul class="nav-tree nav-tree--level-{{ branch_level }}" data-sticky data-sticky-parent="page" data-sticky-offset="100" data-sticky-detach-at="971">
+                        <li class="nav-tree__item">
+                            <a class="nav-tree__link{% if page.is_current %} active{% endif %}" href="{{ page.get_absolute_url }}">{% trans 'Accueil' %}</a>
+                        </li>
                     {% endif %}
-                {% endif %}
-                {% if page.is_primary and page.is_current_or_ascendant %}
-                </ul>
-                {% endif %}
-            {% endif %}
-        {% endfor %}
-    {% endif %}
-    {% if branch_level == 1 %}
-        {% for page in page_branch %}
-            <li class="nav-tree__item">
-                <a class="nav-tree__link{% if page.is_current or page.is_current_or_ascendant %} active{% endif %}" href="{{ page.get_absolute_url }}">{{ page.title }}</a>
-                {% if page.is_current_or_ascendant and page.has_children_in_menu %}
-                    <ul class="nav-tree nav-tree--level-{{ branch_level }}">
-                        {% page_menu page %}
-                    </ul>
-                    <ul class="nav-tree" data-summary>
-                        {% include "pages/menus/current_tree_summary.html" %}
-                    </ul>
-                {% endif %}
-                {% if page.is_current_or_ascendant and not page.has_children_in_menu %}
-                    <ul class="nav-tree" data-summary>
-                        {% include "pages/menus/current_tree_summary.html" %}
+                    {% if page.is_current_or_ascendant %}
+                        {% if page.has_children_in_menu %}
+                            {% page_menu page %}
+                        {% endif %}
+                    {% endif %}
+                    {% if page.is_primary and page.is_current_or_ascendant %}
                     </ul>
+                    {% endif %}
+                {% elif page.in_menu and current_page.in_menus == page.in_menus %}
+                    {{ page.title }} {{ page.in_menus }}
                 {% endif %}
-            </li>
-        {% endfor %}
-    {% endif %}
-    {% if branch_level == 2 %}
-        {% for page in page_branch %}
-            {% comment %}
-            <li class="nav-tree__item nav-tree__item--sub">
-                <a class="nav-tree__link nav-tree__link--sub" href="{{ page.get_absolute_url }}">{{ page.title }}</a>
-            </li>
-            {% endcomment %}
-        {% endfor %}
-    {% endif %}
+            {% endfor %}
+        {% endif %}
+        {% if branch_level == 1 %}
+            {% for page in page_branch %}
+                <li class="nav-tree__item">
+                    <a class="nav-tree__link{% if page.is_current or page.is_current_or_ascendant %} active{% endif %}" href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+                    {% if page.is_current_or_ascendant and page.has_children_in_menu %}
+                        <ul class="nav-tree nav-tree--level-{{ branch_level }}">
+                            {% page_menu page %}
+                        </ul>
+                        <ul class="nav-tree" data-summary>
+                            {% include "pages/menus/current_tree_summary.html" %}
+                        </ul>
+                    {% endif %}
+                    {% if page.is_current_or_ascendant and not page.has_children_in_menu %}
+                        <ul class="nav-tree" data-summary>
+                            {% include "pages/menus/current_tree_summary.html" %}
+                        </ul>
+                    {% endif %}
+                </li>
+            {% endfor %}
+        {% endif %}
+        {% if branch_level == 2 %}
+            {% for page in page_branch %}
+                {% comment %}
+                <li class="nav-tree__item nav-tree__item--sub">
+                    <a class="nav-tree__link nav-tree__link--sub" href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+                </li>
+                {% endcomment %}
+            {% endfor %}
+        {% endif %}
+    {% endwith %}
 {% endif %}
 {% endspaceless %}