grav/themes/quark-open-publishing/templates/sections.html.twig

161 lines
6.8 KiB
Twig

{% extends 'partials/base.html.twig' %}
{% if page.parent.parent.header.hide_next_prev_page_buttons is defined %}
{% set hide_next_prev_page_buttons = page.parent.parent.header.hide_next_prev_page_buttons %}
{% elseif page.parent.header.hide_next_prev_page_buttons is defined %}
{% set hide_next_prev_page_buttons = page.parent.header.hide_next_prev_page_buttons %}
{% endif %}
{% block content %}
{% set activetag = uri.param('filter') %}
<div class="columns">
<div id="sections-content" class="column col-9 col-md-12">
{% if not(page.header.hide_page_title) and not(grav.uri.param('hidepagetitle')) %}
<h3 class="sections-page-title-template">{{ page.title }}</h3>
{% endif %}
{{ page.content|raw }}
{% if not(hide_next_prev_page_buttons) %}
<p class="prev-next">
{% set siblings = page.collection({
'items': {
'@page.children.visible': page.parent.route
}
}) %}
{% set children = page.collection({
'items': {
'@page.children.visible': page.route
}
}) %}
{% if not(page.template == 'sections') %}
{% if not siblings.isFirst(page.path) %}
{% if children | length != 0 %}
{% if (siblings.nextSibling(page.path).children | last) %}
<a class="btn btn-primary" href="{% if activetag %}{{ siblings.nextSibling(page.path).children|last.url ~ '/filter:' ~ activetag }}{% else %}{{ siblings.nextSibling(page.path).children|last.url }}{% endif %}">
<i class="fa fa-chevron-left"></i>
{{ siblings.nextSibling(page.path).children|last.menu }}
</a>
{% else %}
<a class="btn btn-primary" href="{% if activetag %}{{ siblings.nextSibling(page.path).url ~ '/filter:' ~ activetag }}{% else %}{{ siblings.nextSibling(page.path).url }}{% endif %}">
<i class="fa fa-chevron-left"></i>
{{ siblings.nextSibling(page.path).menu }}</a>
{% endif %}
{% else %}
{% if siblings.nextSibling(page.path).url %}
<a class="btn btn-primary" href="{% if activetag %}{{ siblings.nextSibling(page.path).url ~ '/filter:' ~ activetag }}{% else %}{{ siblings.nextSibling(page.path).url }}{% endif %}">
<i class="fa fa-chevron-left"></i>
{{ siblings.nextSibling(page.path).menu }}</a>
{% endif %}
{% endif %}
{% else %}
{% if not(page.parent.template == 'sections') %}
<a class="btn btn-primary" href="{% if activetag %}{{ page.parent.url ~ '/filter:' ~ activetag }}{% else %}{{ page.parent.url }}{% endif %}">
<i class="fa fa-chevron-left"></i>
{{ page.parent.menu }}</a>
{% endif %}
{% endif %}
{% if not siblings.isLast(page.path) %}
{% if children | length == 0 %}
{% if siblings.prevSibling(page.path).url %}
<a class="btn btn-primary" href="{% if activetag %}{{ siblings.prevSibling(page.path).url ~ '/filter:' ~ activetag }}{% else %}{{ siblings.prevSibling(page.path).url }}{% endif %}">{{ siblings.prevSibling(page.path).menu }}
<i class="fa fa-chevron-right"></i>
</a>
{% endif %}
{% else %}
<a class="btn btn-primary" href="{% if activetag %}{{ page.children|first.url ~ '/filter:' ~ activetag }}{% else %}{{ page.children|first.url }}{% endif %}">{{ page.children|first.menu }}
<i class="fa fa-chevron-right"></i>
</a>
{% endif %}
{% else %}
{% if not(page.parent.template == 'sections') %}
{% set siblings = page.collection({
items: {
'@page.children.visible': page.parent.parent.route
}
}) %}
{% if not siblings.isLast(page.parent.path) %}
<a class="btn btn-primary" href="{% if activetag %}{{ siblings.prevSibling(page.parent.path).url ~ '/filter:' ~ activetag }}{% else %}{{ siblings.prevSibling(page.parent.path).url }}{% endif %}">{{ siblings.prevSibling(page.parent.path).menu }}
<i class="fa fa-chevron-right"></i>
</a>
{% endif %}
{% else %}
{% if page.children.count != 0 %}
<a class="btn btn-primary" href="{% if activetag %}{{ page.children|first.url ~ '/filter:' ~ activetag }}{% else %}{{ page.children|first.url }}{% endif %}">{{ page.children|first.menu }}
<i class="fa fa-chevron-right"></i>
</a>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</p>
</div>
<div id="sections-nav" class="column col-3 col-md-12">
<ul class="nav">
{% set collection = page.collection.visible() %}
{% if collection is empty %}
{% set collection = page.parent.collection.visible() %}
{% if collection is empty %}
{% set collection = page.parent.parent.collection.visible() %}
{% endif %}
{% endif %}
{% for p in collection %}
{% set current_parent = p.active
? 'active'
: '' %}
<li class="nav-item {{ current_parent }}">
<a href="{% if activetag %}{{ p.url ~ '/filter:' ~ activetag }}{% else %}{{ p.url }}{% endif %}">{{ p.menu }}</a>
</li>
{% if p.children.visible.count != 0 %}
{% if p.active or(p.slug == page.parent.slug) %}
<ul class="nav">
{% for child in p.children.visible %}
{% set current_child = child.active
? 'active'
: '' %}
{% if activetag %}
{% if activetag in child.taxonomy['filter'] %}
<li class="nav-item {{ current_child }}">
<a href="{% if activetag %}{{ child.url ~ '/filter:' ~ activetag }}{% else %}{{ child.url }}{% endif %}">{{ child.menu }}</a>
</li>
{% endif %}
{% else %}
<li class="nav-item {{ current_child }}">
<a href="{% if activetag %}{{ child.url ~ '/filter:' ~ activetag }}{% else %}{{ child.url }}{% endif %}">{{ child.menu }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% endblock %}