mirror of
https://github.com/PR0M3TH3AN/Archivox.git
synced 2025-09-07 14:48:40 +00:00
refactor sidebar to use details
This commit is contained in:
@@ -1,10 +1,21 @@
|
|||||||
{% macro renderNav(items) %}
|
{% macro renderNav(items, pageUrl) %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for item in items %}
|
{% for item in items %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ item.path }}">{{ item.page.title }}</a>
|
|
||||||
{% if item.children and item.children.length %}
|
{% if item.children and item.children.length %}
|
||||||
{{ renderNav(item.children) }}
|
{% set sectionPath = item.path | replace('index.html', '') %}
|
||||||
|
<details class="nav-section" {% if pageUrl.startsWith(sectionPath) %}open{% endif %}>
|
||||||
|
<summary>
|
||||||
|
<a href="{{ item.path }}" class="nav-link{% if item.path === pageUrl %} active{% endif %}">
|
||||||
|
{{ item.displayName or item.page.title }}
|
||||||
|
</a>
|
||||||
|
</summary>
|
||||||
|
{{ renderNav(item.children, pageUrl) }}
|
||||||
|
</details>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ item.path }}" class="nav-link{% if item.path === pageUrl %} active{% endif %}">
|
||||||
|
{{ item.displayName or item.page.title }}
|
||||||
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -13,6 +24,6 @@
|
|||||||
|
|
||||||
<aside class="sidebar" id="sidebar">
|
<aside class="sidebar" id="sidebar">
|
||||||
<nav>
|
<nav>
|
||||||
{{ renderNav(navigation) }}
|
{{ renderNav(navigation, page.url) }}
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
Reference in New Issue
Block a user