docs/layouts/partials/docs-side-nav.html

137 lines
4.0 KiB
HTML

{{ $.Scratch.Set "topLevel" . }}
{{ range $product := $.Site.Sections }}
{{ range $version := .Sections }}
{{ range $language := .Sections }}
{{if $.CurrentSection}}
{{ if .IsAncestor $.CurrentSection }}
{{ $.Scratch.Set "topLevel" . }}
{{end}}
{{end}}
{{end}}
{{end}}
{{end}}
<!-- product dropdown -->
<div class="side-menus-container product-select tree-nav jquery-accordion-menu">
<ul class="side-menus-wrap">
<li class="tree-nav-item">
<a>
{{ range $product := $.Site.Sections }}
{{ range $version := .Sections }}
{{ range $language := .Sections }}
{{if $.CurrentSection}}
{{ if .IsAncestor $.CurrentSection }}
{{ .Params.shortTitle }}
{{end}}
{{end}}
{{end}}
{{end}}
{{end}}
<span class="submenu-indicator">
<span class="object1"></span>
<span class="object2"></span>
<span class="object3"></span>
</span>
</a>
<ul class="tree-nav-sublist submenu submenus-wrap hide">
{{ range $product := $.Site.Sections }}
{{ range $version := .Sections }}
{{ range $language := .Sections }}
<li><a href="{{ .Permalink }}">{{ .Params.shortTitle }}</a></li>
{{ if .Params.insertonesix }}
<li><a href="https://rancher.com/docs/rancher/v1.6/en/" target="blank">Rancher 1.6</a></li>
{{end}}
{{end}}
{{end}}
{{end}}
</ul>
</li>
</ul>
</div>
<div class="guide-menus-activator">
{{ if .Title }}
{{.Title}}
{{ else if .Params.shortTitle }}
{{.Params.shortTitle}}
{{ else }}
(No Title)
{{end}}
<span class="indicator">
<span class="object1"></span>
<span class="object2"></span>
<span class="object3"></span>
</span>
</div>
<div class="side-menus-container guide-menus tree-nav jquery-accordion-menu">
<ul class="side-menus-wrap second">
{{ $activeNode := . }}
{{ range ($.Scratch.Get "topLevel").Sections }}
{{ template "menu" dict "node" . "activeNode" $activeNode }}
{{ end }}
</ul>
</div>
{{ define "menu" }}
{{/* .node and .activeNode come from the caller */}}
{{- $activeNode := .activeNode -}}
{{- with .node -}}
{{- $isActive := "" -}}
{{- if eq .UniqueID $activeNode.UniqueID -}}
{{- $isActive = "active" -}}
{{- end -}}
{{- $isOpen := false -}}
{{- if (or .Params.alwaysOpen (.IsAncestor $activeNode)) -}}
{{- $isOpen = true -}}
{{- end -}}
{{- if .IsSection -}}
{{- $children := (add (len .Pages) (len .Sections)) -}}
<li class="tree-nav-item {{ $isActive }}">
<a href="{{ .URL }}" class="{{if $isOpen}}submenu-indicator-minus{{end}}">
{{- if .Params.shortTitle -}}
{{ .Params.shortTitle}}
{{- else -}}
{{ .Title }}
{{- end -}}
{{- if gt $children 0 -}}
<span class="submenu-indicator">
<span class="object1"></span>
<span class="object2"></span>
<span class="object3"></span>
</span>
{{- end -}}
</a>
{{if gt $children 0}}
<ul class="tree-nav-sublist submenu submenus-wrap {{ if not $isOpen }}hide{{end}}">
{{- $pages := .Pages -}}
{{- if .Sections -}}
{{- $pages = (.Pages | union .Sections) -}}
{{- end -}}
{{- range $pages.ByWeight -}}
{{- if not .Params.hidden -}}
{{template "menu" dict "node" . "activeNode" $activeNode}}
{{- end -}}
{{- end -}}
</ul>
{{- end -}}
</li>
{{- else if not .Params.hidden -}}
<li class="{{ $isActive }}">
<a href="{{ .URL }}">
{{- if .Params.shortTitle -}}
{{ .Params.shortTitle}}
{{- else -}}
{{ .Title }}
{{- end -}}
</a>
</li>
{{- end -}}
{{ end }}
{{ end }}