forked from ag_kommunikation/webseite
Navigation mit 2 Ebenen generiert aus Databag hinzugefügt.
This commit is contained in:
parent
0a94a0fba4
commit
368e28bdfd
26
databags/navigation.json
Normal file
26
databags/navigation.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"home": {
|
||||||
|
"href": "/",
|
||||||
|
"items": {}
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"href": "/about",
|
||||||
|
"items": {}
|
||||||
|
},
|
||||||
|
"specs": {
|
||||||
|
"href": "/specs",
|
||||||
|
"list_childs": true,
|
||||||
|
"items": {
|
||||||
|
"members": "/members",
|
||||||
|
"lines of code": "/lines_of_code"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mission": {
|
||||||
|
"href": "/faq",
|
||||||
|
"items": {}
|
||||||
|
},
|
||||||
|
"legal": {
|
||||||
|
"href": "/member",
|
||||||
|
"items": {}
|
||||||
|
}
|
||||||
|
}
|
@ -42,17 +42,28 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="nav__navlist">
|
<ul class="nav__navlist">
|
||||||
<li class="nav__navitem {% if this._path == '/' %}-active{% endif %}">
|
{% for title, mapping in bag("navigation").items() %}
|
||||||
<a class="nav__navlink {% if this._path == '/' %}-active{% endif %}" href="{{ '/'|url }}">home</a>
|
<li class="nav__navitem
|
||||||
</li>
|
{%- if this._path == mapping.href or mapping.href != '/' and this.is_child_of(mapping.href) %}
|
||||||
{% for href, title in [
|
-active
|
||||||
['/about', 'about'],
|
{%- endif -%}
|
||||||
['/specs', 'specs'],
|
">
|
||||||
['/legal', 'legal']
|
<a class="nav__navlink {% if this._path == mapping.href %}-active{% endif %}" href="{{ mapping.href|url }}">
|
||||||
]
|
{{ title }}
|
||||||
%}
|
</a>
|
||||||
<li class="nav__navitem {% if this.is_child_of(href) %}-active{% endif %}">
|
{% if mapping.list_childs %}
|
||||||
<a class="nav__navlink {% if this.is_child_of(href) %}-active{% endif %}" href="{{ href|url }}">{{ title }}</a></li>
|
<ul class="nav__sub_navlist">
|
||||||
|
{% set sub_menu = mapping['items'].items() %}
|
||||||
|
{% for sub_title, href in sub_menu %}
|
||||||
|
<li class="nav__sub_navitem {%- if this._path == href %} -active{%- endif %}">
|
||||||
|
<a class="nav__navlink {% if this._path == href %}-active{% endif %}" href="{{ href|url }}">
|
||||||
|
{{ sub_title }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
Loading…
Reference in New Issue
Block a user