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 %}
<li class="md-tabs__item"> {% set title = title | default(nav_item.title) %}
{% if nav_item.active %} {% if (nav_item.children | first).children | length > 0 %}
<a href="{{ (nav_item.children | first).url }}" title="{{ nav_item.title }}" class="md-tabs__link md-tabs__link--active"> {% set nav_item = nav_item.children | first %}
{{ nav_item.title }} {% include "partials/tabs-item.html" %}
</a> {% else %}
{% else %} <li class="md-tabs__item">
<a href="{{ (nav_item.children | first).url }}" title="{{ nav_item.title }}" class="md-tabs__link"> {% if nav_item.active %}
{{ nav_item.title }} <a href="{{ (nav_item.children | first).url }}" title="{{ title }}" class="md-tabs__link md-tabs__link--active">
</a> {{ title }}
{% endif %} </a>
</li> {% else %}
<a href="{{ (nav_item.children | first).url }}" title="{{ title }}" class="md-tabs__link">
{{ title }}
</a>
{% endif %}
</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 %}
<li class="md-tabs__item"> {% set title = title | default(nav_item.title) %}
{% if nav_item.active %}
<a href="{{ (nav_item.children | first).url }}" <!-- Recurse, if the first item has nested items -->
title="{{ nav_item.title }}" {% if (nav_item.children | first).children | length > 0 %}
class="md-tabs__link md-tabs__link--active"> {% set nav_item = nav_item.children | first %}
{{ nav_item.title }} {% include "partials/tabs-item.html" %}
</a>
{% else %} <!-- Render item -->
<a href="{{ (nav_item.children | first).url }}" {% else %}
title="{{ nav_item.title }}" class="md-tabs__link"> <li class="md-tabs__item">
{{ nav_item.title }} {% if nav_item.active %}
</a> <a href="{{ (nav_item.children | first).url }}"
{% endif %} title="{{ title }}" class="md-tabs__link md-tabs__link--active">
</li> {{ title }}
</a>
{% else %}
<a href="{{ (nav_item.children | first).url }}"
title="{{ title }}" class="md-tabs__link">
{{ title }}
</a>
{% endif %}
</li>
{% endif %}
{% endif %} {% endif %}