diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2023-02-25 13:15:44 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2023-02-25 13:15:44 +0100 |
| commit | 900bb5e845c3ad44defbd427cae3d44a4a43321f (patch) | |
| tree | df3d96a93771884add571e82336c29fc3d9c7a1c /code/frontpage/layouts/partials/sidebar | |
| download | greatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.tar.xz greatoffice-900bb5e845c3ad44defbd427cae3d44a4a43321f.zip | |
feat: Initial commit
Diffstat (limited to 'code/frontpage/layouts/partials/sidebar')
6 files changed, 233 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> diff --git a/code/frontpage/layouts/partials/sidebar/auto-default-menu.html b/code/frontpage/layouts/partials/sidebar/auto-default-menu.html new file mode 100644 index 0000000..6e4565b --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/auto-default-menu.html @@ -0,0 +1,37 @@ +<!-- Auto default section menu --> +{{ $currentPage := . -}} +{{ $section := $currentPage.Section -}} +{{ range (where .Site.Sections "Section" "in" $section) }} + {{ range .Sections }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} + <h3 class="h6 text-uppercase mb-2">{{ .Title }}</h3> + <ul class="list-unstyled"> + {{ range .Pages }} + {{ if .IsNode }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} + <h4 class="h6 text-uppercase ms-3 mt-3 mb-2">{{ .Title }}</h4> + <ul class="list-unstyled ms-3"> + {{ range .Pages }} + {{ if .IsNode }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} + <h5 class="h6 text-uppercase mt-2 mb-2">{{ .Title }}</h5> + <ul class="list-unstyled ms-3"> + {{ range .Pages }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} + <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .Permalink }}">{{ .Name }}</a></li> + {{ end }} + </ul> + {{ else }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} + <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .Permalink }}">{{ .Name }}</a></li> + {{ end }} + {{ end }} + </ul> + {{ else }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} + <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .Permalink }}">{{ .Name }}</a></li> + {{ end }} + {{ end }} + </ul> + {{ end }} +{{ end }} diff --git a/code/frontpage/layouts/partials/sidebar/docs-menu.html b/code/frontpage/layouts/partials/sidebar/docs-menu.html new file mode 100644 index 0000000..b7baebb --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/docs-menu.html @@ -0,0 +1,9 @@ +{{ if and .Site.Params.menu.section.auto .Site.Params.menu.section.collapsibleSidebar -}} + {{ partial "sidebar/auto-collapsible-menu.html" . -}} +{{ else if and .Site.Params.menu.section.auto (not .Site.Params.menu.section.collapsibleSidebar) -}} + {{ partial "sidebar/auto-default-menu.html" . -}} +{{ else if and (not .Site.Params.menu.section.auto) .Site.Params.menu.section.collapsibleSidebar -}} + {{ partial "sidebar/manual-collapsible-menu.html" . -}} +{{ else if and (not .Site.Params.menu.section.auto) (not .Site.Params.menu.section.collapsibleSidebar) -}} + {{ partial "sidebar/manual-default-menu.html" . -}} +{{ end -}}
\ No newline at end of file diff --git a/code/frontpage/layouts/partials/sidebar/docs-toc.html b/code/frontpage/layouts/partials/sidebar/docs-toc.html new file mode 100644 index 0000000..c71a7b8 --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/docs-toc.html @@ -0,0 +1,26 @@ +{{ if and (ne .Params.toc false) (ne .TableOfContents "<nav id=\"TableOfContents\"></nav>") -}} +<div class="d-xl-none"> + <button class="btn btn-outline-primary btn-sm doks-toc-toggle collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#onThisPage" aria-controls="doks-docs-nav" aria-expanded="false" aria-label="Toggle On this page navigation"> + <span>{{ i18n "on-this-page" }}</span> + <span> + <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" class="doks doks-expand" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><title>Expand</title><polyline points="7 13 12 18 17 13"></polyline><polyline points="7 6 12 11 17 6"></polyline></svg> + <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" class="doks doks-collapse" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><title>Collapse</title><polyline points="17 11 12 6 7 11"></polyline><polyline points="17 18 12 13 7 18"></polyline></svg> + </span> + </button> + <div class="collapse" id="onThisPage"> + <div class="card card-body mt-3 py-1"> + <div class="page-links"> + {{ .TableOfContents }} + </div> + </div> + </div> +</div> +<div class="page-links d-none d-xl-block"> + <h3>{{ i18n "on-this-page" }}</h3> + {{ if eq .Site.Params.options.scrollSpy true -}} + {{ .TableOfContents | replaceRE "<nav id=\"TableOfContents\">" "<nav id=\"toc\">" | safeHTML }} + {{ else -}} + {{ .TableOfContents }} + {{ end -}} +</div> +{{ end -}} diff --git a/code/frontpage/layouts/partials/sidebar/manual-collapsible-menu.html b/code/frontpage/layouts/partials/sidebar/manual-collapsible-menu.html new file mode 100644 index 0000000..f83c667 --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/manual-collapsible-menu.html @@ -0,0 +1,63 @@ +<!-- Manual collapsible section menu --> +<ul class="list-unstyled collapsible-sidebar"> + {{ $currentPage := . -}} + {{ $section := $currentPage.Section -}} + {{ range (index .Site.Menus $section) -}} + {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} + <li class="mb-1"> + <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}"> + {{ .Name }} + </button> + {{ if .HasChildren -}} + <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}"> + <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small"> + {{ range .Children -}} + {{ if .HasChildren -}} + <li class="my-1 ms-3"> + <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}"> + {{ .Name }} + </button> + {{ if .HasChildren -}} + <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}"> + <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small"> + {{ range .Children -}} + {{ if .HasChildren -}} + <li class="my-1 ms-3"> + <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}"> + {{ .Name }} + </button> + {{ if .HasChildren -}} + <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}"> + <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small"> + {{ range .Children -}} + {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} + <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> + {{ end -}} + </ul> + </div> + {{ end -}} + </li> + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} + <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> + {{ end -}} + {{ end -}} + </ul> + </div> + {{ end -}} + </li> + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} + <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> + {{ end -}} + {{ end -}} + </ul> + </div> + {{ end -}} + </li> + {{ end -}} +</ul> diff --git a/code/frontpage/layouts/partials/sidebar/manual-default-menu.html b/code/frontpage/layouts/partials/sidebar/manual-default-menu.html new file mode 100644 index 0000000..32c4cd4 --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/manual-default-menu.html @@ -0,0 +1,41 @@ +<!-- Manual default section menu --> +{{ $currentPage := . -}} +{{ $section := $currentPage.Section -}} +{{ range (index .Site.Menus $section) -}} + <h3 class="h6 text-uppercase mb-2">{{ .Name }}</h3> + {{ if .HasChildren -}} + <ul class="list-unstyled"> + {{ range .Children -}} + {{ if .HasChildren -}} + <h4 class="h6 text-uppercase ms-3 mt-3 mb-2">{{ .Name }}</h4> + {{ if .HasChildren -}} + <ul class="list-unstyled ms-3"> + {{ range .Children -}} + {{ if .HasChildren -}} + <h5 class="h6 text-uppercase mt-2 mb-2">{{ .Name }}</h5> + {{ if .HasChildren -}} + <ul class="list-unstyled ms-3"> + {{ range .Children -}} + {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} + <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> + {{ end -}} + </ul> + {{ end -}} + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} + <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> + {{ end -}} + {{ end -}} + </ul> + {{ end -}} + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} + <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> + {{ end -}} + {{ end -}} + </ul> + {{ end -}} +{{ end -}} |
