aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2020-09-14 22:45:31 +0200
committerAlex Shpak <alex-shpak@users.noreply.github.com>2020-09-14 22:45:58 +0200
commit5cc3d6719cd596c9828c8dce5e9a9e934f333f93 (patch)
tree834076658db112b63566b72851fc2e92aa19005f /layouts
parent4e34988b5db9f4e78e1d27458e867be9a8f2db84 (diff)
#231, Allow open collapsed menu without changing page
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/docs/menu-filetree.html23
1 files changed, 13 insertions, 10 deletions
diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html
index fcde91e..3ca9db2 100644
--- a/layouts/partials/docs/menu-filetree.html
+++ b/layouts/partials/docs/menu-filetree.html
@@ -8,11 +8,6 @@
{{ end }}
{{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}}
- {{ $self := eq .CurrentPage .Section }}
- {{ $ancestor := .Section.IsAncestor .CurrentPage }}
- {{ $collapsed := .Section.Params.bookCollapseSection }}
-
- {{ if or $self $ancestor (not $collapsed) }}
<ul>
{{ range (where .Section.Pages "Params.bookhidden" "ne" true) }}
{{ if .IsSection }}
@@ -27,14 +22,22 @@
{{ end }}
{{ end }}
</ul>
- {{ end }}
{{ end }}
{{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}}
- {{ if .Page.Content }}
- <a href="{{ .Page.RelPermalink }}" class="
- {{- if and .Page.Params.bookCollapseSection .Page.IsSection }}collapsed {{ end }}
- {{- if eq .CurrentPage .Page }}active{{ end }}">
+ {{ $current := eq .CurrentPage .Page }}
+ {{ $ancestor := .Page.IsAncestor .CurrentPage }}
+
+ {{ if .Page.Params.bookCollapseSection }}
+ <input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
+ <label for="section-{{ md5 .Page }}" class="flex justify-between">
+ <a {{ if .Page.Content }}href="{{ .Page.Permalink }}"{{ end }} class="{{ if $current }}active{{ end }}">
+ {{- partial "docs/title" .Page -}}
+ </a>
+ <span>▾</span>
+ </label>
+ {{ else if .Page.Content }}
+ <a href="{{ .Page.Permalink }}" class="{{ if $current }} active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
{{ else }}