aboutsummaryrefslogtreecommitdiffstats
path: root/code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2023-02-25 13:15:44 +0100
committerivarlovlie <git@ivarlovlie.no>2023-02-25 13:15:44 +0100
commit900bb5e845c3ad44defbd427cae3d44a4a43321f (patch)
treedf3d96a93771884add571e82336c29fc3d9c7a1c /code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html
downloadgreatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.tar.xz
greatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.zip
feat: Initial commit
Diffstat (limited to 'code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html')
-rw-r--r--code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html b/code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html
new file mode 100644
index 0000000..4600d0a
--- /dev/null
+++ b/code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html
@@ -0,0 +1,57 @@
+<!-- Auto collapsible section menu -->
+<ul class="list-unstyled collapsible-sidebar">
+ {{ $currentPage := . -}}
+ {{ $section := $currentPage.Section -}}
+ {{ range (where .Site.Sections "Section" "in" $section) }}
+ {{ range .Sections }}
+ {{ $active := in $currentPage.RelPermalink .RelPermalink }}
+ <li class="mb-1">
+ <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ md5 .Title }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}">
+ {{ .Title }}
+ </button>
+ <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ md5 .Title }}">
+ <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
+ {{ range .Pages }}
+ {{ if .IsNode }}
+ {{ $active := in $currentPage.RelPermalink .RelPermalink }}
+ <li class="my-1 ms-3">
+ <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ md5 .Title }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}">
+ {{ .Title }}
+ </button>
+ <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ md5 .Title }}">
+ <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
+ {{ range .Pages }}
+ {{ if .IsNode }}
+ {{ $active := in $currentPage.RelPermalink .RelPermalink }}
+ <li class="my-1 ms-3">
+ <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ md5 .Title }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}">
+ {{ .Title }}
+ </button>
+ <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ md5 .Title }}">
+ <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
+ {{ range .Pages }}
+ {{ $active := in $currentPage.RelPermalink .RelPermalink }}
+ <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .Permalink }}">{{ .Title }}</a></li>
+ {{ end }}
+ </ul>
+ </div>
+ </li>
+ {{ else }}
+ {{ $active := in $currentPage.RelPermalink .RelPermalink }}
+ <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .Permalink }}">{{ .Title }}</a></li>
+ {{ end }}
+ {{ end }}
+ </ul>
+ </div>
+ </li>
+ {{ else }}
+ {{ $active := in $currentPage.RelPermalink .RelPermalink }}
+ <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .Permalink }}">{{ .Title }}</a></li>
+ {{ end }}
+ {{ end }}
+ </ul>
+ </div>
+ </li>
+ {{ end }}
+ {{ end }}
+</ul>