focalboard/website/site/layouts/partials/sidebar.html
2021-01-07 14:12:26 -08:00

65 lines
3.1 KiB
HTML

<div class="col-lg-3 sidebar">
<div class="sidebar__menu-toggle">
{{ .Title }}
<i class="fa fa-bars pull-right"></i>
</div>
<div class="row sidebar__links">
{{ range where .Site.Params.sidebar.item "name" $.Section }}
{{ range where $.Site.Pages ".Params.section" .name }}
{{ $active := (eq $.Title .Title) }}
{{ $expanded := or (eq $.Params.subsection .Title) $active (eq $.Parent.Params.subsection .Title) }}
{{ $.Scratch.Set "icon" "fa-plus-square-o" }}
{{ if $expanded }}
{{ $.Scratch.Set "icon" "fa-minus-square-o" }}
{{ end }}
{{if eq (len (.Pages)) 0}}
{{ $.Scratch.Set "iconstyle" "display: none" }}
{{ else }}
{{ $.Scratch.Set "iconstyle" "" }}
{{ end }}
<span class="item {{ if $active }}active{{ end }}">
<i class="sub-menu__toggle fa {{$.Scratch.Get "icon"}}" aria-hidden="true" style="{{$.Scratch.Get "iconstyle"}}"></i>
{{ if $active }}
<a class="active" href="#"> {{ .Title }}</a>
{{ else }}
<a href="{{ .Permalink }}"> {{ .Title }}</a>
{{ end }}
</span>
<ul class="sub-menu" {{ if $expanded }}style="display: block"{{ end }}>
{{ range .Pages.ByWeight }}
{{ $subactive := (eq $.Title .Title) }}
{{ $subexpanded := or (eq .Title $.Params.subsection) $subactive }}
{{ $.Scratch.Set "subicon" "fa-plus-square-o" }}
{{ if $subexpanded }}
{{ $.Scratch.Set "subicon" "fa-minus-square-o" }}
{{ end }}
{{if eq (len (.Pages)) 0}}
{{ $.Scratch.Set "iconstyle" "display: none" }}
{{ else }}
{{ $.Scratch.Set "iconstyle" "" }}
{{ end }}
<span class="item {{ if $subactive }}active{{ end }}">
<i class="sub-menu__toggle fa {{$.Scratch.Get "subicon"}}" aria-hidden="true" style="{{$.Scratch.Get "iconstyle"}}"></i>
{{ if $subactive }}
<a class="active" href="{{ .Permalink }}"> {{ .Title }}</a></span>
{{ else }}
<a href="{{ .Permalink }}"> {{ .Title }}</a></span>
{{ end }}
</span>
<ul class="sub-menu" {{ if $subexpanded }}style="display: block"{{ end }}>
{{ range .Pages.ByWeight }}
<a class="item {{ if eq $.Title .Title }}active{{ end }}" href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }}
</ul>
{{ end }}
</ul>
{{ end }}
{{ end }}
</div>
</div>