mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-06-07 20:08:54 +00:00
Macros redefined for navigation
This commit is contained in:
parent
f36b48e4d7
commit
5c4324e14c
2 changed files with 30 additions and 63 deletions
|
@ -20,30 +20,21 @@
|
||||||
{% macro nav_loop(page) %}
|
{% macro nav_loop(page) %}
|
||||||
{% import _self as nav_macros %}
|
{% import _self as nav_macros %}
|
||||||
{% for p in page.children.visible %}
|
{% for p in page.children.visible %}
|
||||||
{% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
|
{% set active_page = (p.active or p.activeChild) ? 'active' : '' %}
|
||||||
{% if p.children.visible.count > 0 %}
|
{% set has_visible_children = p.children.visible.count > 0 %}
|
||||||
<li class="{{ current_page }}">
|
<li>
|
||||||
<a>
|
<a href="{{ p.url }}" class="{{ active_page }}">
|
||||||
{% if p.header.icon %}
|
{% if p.header.icon %}
|
||||||
<i class="fa fa-{{ p.header.icon }}"></i>
|
<i class="fa fa-{{ p.header.icon }}"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ p.menu }}
|
{{ p.menu }}
|
||||||
{% if p.routable ?? false %} <i class="fa fa-angle-down"></i>
|
{% if has_visible_children %} <i class="fa fa-angle-down"></i>{% endif %}
|
||||||
{% endif %}
|
</a>
|
||||||
</a>
|
{% if has_visible_children %}
|
||||||
<ul>
|
<ul>
|
||||||
{{ nav_macros.nav_loop(p) }}
|
{{ nav_macros.nav_loop(p) }}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
{% endif %}
|
||||||
{% else %}
|
</li>
|
||||||
<li class="{{ current_page }}">
|
|
||||||
<a href="{{ p.url }}">
|
|
||||||
{% if p.header.icon %}
|
|
||||||
<i class="fa fa-{{ p.header.icon }}"></i>
|
|
||||||
{% endif %}
|
|
||||||
<span>{{ p.menu }}</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
|
@ -1,34 +1,22 @@
|
||||||
{% block menu_navigation %}
|
{% block menu_navigation %}
|
||||||
{% macro loop(page) %}
|
{% macro loop(page) %}
|
||||||
{% for p in page.children.visible %}
|
{% for p in page.children.visible %}
|
||||||
{% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
|
{% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
|
||||||
{% if p.children.visible.count > 0 %}
|
<li class="{{ current_page }}">
|
||||||
<li class="{{ current_page }}">
|
<a href="{{ p.url }}">
|
||||||
<a class="dropdown-btn">
|
|
||||||
{% if p.header.icon %}
|
{% if p.header.icon %}
|
||||||
<i class="fa fa-{{ p.header.icon }}"></i>
|
<i class="fa fa-{{ p.header.icon }}"></i>
|
||||||
{% endif %}
|
|
||||||
<span>{{ p.menu }}
|
|
||||||
{% if p.routable ?? false %} <i class="fa fa-caret-down"></i>
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
<ul class="subitem_hide">
|
|
||||||
{{ _self.loop(p) }}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
{% else %}
|
|
||||||
<li class="{{ current_page }}">
|
|
||||||
<a href="{{ p.url }}">
|
|
||||||
{% if p.header.icon %}
|
|
||||||
<i class="fa fa-{{ p.header.icon }}"></i>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span>{{ p.menu }}</span>
|
<span>{{ p.menu }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
{% if p.children.visible.count > 0 %}
|
||||||
{% endif %}
|
<ul class="subitem">
|
||||||
{% endfor %}
|
{{ _self.loop(p) }}
|
||||||
{% endmacro %}
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
{% endmacro %}
|
||||||
<ul class="menulink">
|
<ul class="menulink">
|
||||||
{{ _self.loop(pages) }}
|
{{ _self.loop(pages) }}
|
||||||
{% if theme_var('custommenus.enabled') %}
|
{% if theme_var('custommenus.enabled') %}
|
||||||
|
@ -44,16 +32,4 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
<script>
|
|
||||||
if ((window.innerWidth || document.documentElement.clientWidth) < 980){
|
|
||||||
/* Script for dropdown menu in sidebar */
|
|
||||||
$(".subitem_hide").hide(); /* this hides the list initially */
|
|
||||||
$(".dropdown-btn").click(function () {
|
|
||||||
$(this).next(".subitem_hide").slideToggle();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Add table
Reference in a new issue