main

mattermost/focalboard

Last updated at: 29/12/2023 09:44

sidebar.html

TLDR

This file is a partial HTML template that represents the sidebar of a website. It contains the markup and logic to render a collapsible sidebar menu.

Methods

This file does not contain any methods.

Classes

This file does not contain any classes.

<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>