Fixed missing link in tabs navigation on deeply nested items

This commit is contained in:
squidfunk 2017-03-02 15:55:22 +01:00 committed by Martin Donath
parent 009b41cdb1
commit bbc48e75bf
2 changed files with 40 additions and 25 deletions

View File

@ -11,15 +11,21 @@
{% endif %} {% endif %}
</li> </li>
{% elif nav_item.children and nav_item.children | length > 0 %} {% elif nav_item.children and nav_item.children | length > 0 %}
{% set title = title | default(nav_item.title) %}
{% if (nav_item.children | first).children | length > 0 %}
{% set nav_item = nav_item.children | first %}
{% include "partials/tabs-item.html" %}
{% else %}
<li class="md-tabs__item"> <li class="md-tabs__item">
{% if nav_item.active %} {% if nav_item.active %}
<a href="{{ (nav_item.children | first).url }}" title="{{ nav_item.title }}" class="md-tabs__link md-tabs__link--active"> <a href="{{ (nav_item.children | first).url }}" title="{{ title }}" class="md-tabs__link md-tabs__link--active">
{{ nav_item.title }} {{ title }}
</a> </a>
{% else %} {% else %}
<a href="{{ (nav_item.children | first).url }}" title="{{ nav_item.title }}" class="md-tabs__link"> <a href="{{ (nav_item.children | first).url }}" title="{{ title }}" class="md-tabs__link">
{{ nav_item.title }} {{ title }}
</a> </a>
{% endif %} {% endif %}
</li> </li>
{% endif %} {% endif %}
{% endif %}

View File

@ -38,18 +38,27 @@
<!-- Main navigation item with nested items --> <!-- Main navigation item with nested items -->
{% elif nav_item.children and nav_item.children | length > 0 %} {% elif nav_item.children and nav_item.children | length > 0 %}
{% set title = title | default(nav_item.title) %}
<!-- Recurse, if the first item has nested items -->
{% if (nav_item.children | first).children | length > 0 %}
{% set nav_item = nav_item.children | first %}
{% include "partials/tabs-item.html" %}
<!-- Render item -->
{% else %}
<li class="md-tabs__item"> <li class="md-tabs__item">
{% if nav_item.active %} {% if nav_item.active %}
<a href="{{ (nav_item.children | first).url }}" <a href="{{ (nav_item.children | first).url }}"
title="{{ nav_item.title }}" title="{{ title }}" class="md-tabs__link md-tabs__link--active">
class="md-tabs__link md-tabs__link--active"> {{ title }}
{{ nav_item.title }}
</a> </a>
{% else %} {% else %}
<a href="{{ (nav_item.children | first).url }}" <a href="{{ (nav_item.children | first).url }}"
title="{{ nav_item.title }}" class="md-tabs__link"> title="{{ title }}" class="md-tabs__link">
{{ nav_item.title }} {{ title }}
</a> </a>
{% endif %} {% endif %}
</li> </li>
{% endif %} {% endif %}
{% endif %}