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) %}
|
||||
{% import _self as nav_macros %}
|
||||
{% for p in page.children.visible %}
|
||||
{% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
|
||||
{% if p.children.visible.count > 0 %}
|
||||
<li class="{{ current_page }}">
|
||||
<a>
|
||||
{% set active_page = (p.active or p.activeChild) ? 'active' : '' %}
|
||||
{% set has_visible_children = p.children.visible.count > 0 %}
|
||||
<li>
|
||||
<a href="{{ p.url }}" class="{{ active_page }}">
|
||||
{% if p.header.icon %}
|
||||
<i class="fa fa-{{ p.header.icon }}"></i>
|
||||
{% endif %}
|
||||
{{ p.menu }}
|
||||
{% if p.routable ?? false %} <i class="fa fa-angle-down"></i>
|
||||
{% endif %}
|
||||
{% if has_visible_children %} <i class="fa fa-angle-down"></i>{% endif %}
|
||||
</a>
|
||||
{% if has_visible_children %}
|
||||
<ul>
|
||||
{{ nav_macros.nav_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 %}
|
||||
<span>{{ p.menu }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
|
@ -2,22 +2,6 @@
|
|||
{% macro loop(page) %}
|
||||
{% for p in page.children.visible %}
|
||||
{% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
|
||||
{% if p.children.visible.count > 0 %}
|
||||
<li class="{{ current_page }}">
|
||||
<a class="dropdown-btn">
|
||||
{% if p.header.icon %}
|
||||
<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 %}
|
||||
|
@ -25,8 +9,12 @@
|
|||
{% endif %}
|
||||
<span>{{ p.menu }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if p.children.visible.count > 0 %}
|
||||
<ul class="subitem">
|
||||
{{ _self.loop(p) }}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
<ul class="menulink">
|
||||
|
@ -45,15 +33,3 @@
|
|||
{% endif %}
|
||||
</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 %}
|
Loading…
Add table
Reference in a new issue