-
Notifications
You must be signed in to change notification settings - Fork 877
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from narrenfrei/dev-menu-structure
rebuilt sidebar menu structure
- Loading branch information
Showing
3 changed files
with
59 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
{{/* The "active" toggle here may delay rendering, so we only cache this side bar menu for bigger sites. */}} | ||
{{ $shouldCache := ge (len .Site.Pages) 2000 }} | ||
{{ $sidebarCacheLimit := cond (isset .Site.Params.ui "sidebar_cache_limit") .Site.Params.ui.sidebar_cache_limit 2000 }} | ||
{{ $shouldCache := ge (len .Site.Pages) $sidebarCacheLimit }} | ||
{{ $sidebarCacheTypeRoot := cond (isset .Site.Params.ui "sidebar_cache_type_root") .Site.Params.ui.sidebar_cache_type_root false }} | ||
{{ if $shouldCache }} | ||
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }} | ||
<script> | ||
$(function() { | ||
$("#td-sidebar-menu #{{ $mid }}").toggleClass("active"); | ||
$("#td-sidebar-menu").toggleClass("d-none"); | ||
}); | ||
</script> | ||
{{ partialCached "sidebar-tree.html" . .CurrentSection.RelPermalink }} | ||
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }} | ||
<script> | ||
$(function() { | ||
$("#td-sidebar-menu a").removeClass("active"); | ||
$("#td-sidebar-menu #{{ $mid }}").addClass("active"); | ||
$("#td-sidebar-menu #{{ $mid }}-li span").addClass("td-sidebar-nav-active-item"); | ||
$("#td-sidebar-menu #{{ $mid }}").parents("li").addClass("active-path"); | ||
$("#td-sidebar-menu li.active-path").addClass("show"); | ||
$("#td-sidebar-menu #{{ $mid }}-li").siblings("li").addClass("show"); | ||
$("#td-sidebar-menu #{{ $mid }}-li").children("ul").children("li").addClass("show"); | ||
$("#td-sidebar-menu").toggleClass("d-none"); | ||
}); | ||
</script> | ||
{{ partialCached "sidebar-tree.html" . .FirstSection.RelPermalink }} | ||
{{ else }} | ||
{{ partial "sidebar-tree.html" . }} | ||
{{ partial "sidebar-tree.html" . }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters