Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Menu: only expand active hierarchy #195

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions layouts/partials/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,25 @@ <h3>{{ if not $disableShortcutsTitle}}{{ T "Shortcuts-Title"}}{{ end }}</h3>
{{with .sect}}
{{if .IsSection}}
{{safeHTML .Params.head}}
{{ $isParent := or (.IsAncestor $currentNode) (.Params.alwaysopen) }}
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
<li data-nav-id="{{.URL}}" title="{{.Title}}" class="dd-item
{{if .IsAncestor $currentNode }}parent{{end}}
{{if $isParent }}parent{{end}}
{{if eq .UniqueID $currentNode.UniqueID}}active{{end}}
{{if .Params.alwaysopen}}parent{{end}}
">
<a href="{{.RelPermalink}}">
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
{{ if and (ne $numberOfPages 0) (ne .Parent .Site.Home) }}
{{if $isParent }}
<i class="fas fa-caret-down"></i>
{{ else }}
<i class="fas fa-caret-right"></i>
{{ end }}
{{ end }}
{{ if $showvisitedlinks}}
<i class="fas read-icon"></i>
{{ end }}
</a>
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
{{ if ne $numberOfPages 0 }}
<ul>
{{ $currentNode.Scratch.Set "pages" .Pages }}
Expand Down
2 changes: 1 addition & 1 deletion static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[typ
#sidebar ul.topics ul ul {
padding-bottom: 0;
}
#sidebar ul.topics li.parent ul, #sidebar ul.topics > li.active ul {
#sidebar ul.topics li.parent > ul {
display: block;
}
#sidebar ul.topics > li > a {
Expand Down