-
Notifications
You must be signed in to change notification settings - Fork 70
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 #235 from 1712n/fix-menus
simple-fixes
- Loading branch information
Showing
13 changed files
with
145 additions
and
124 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
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,5 +1,7 @@ | ||
--- | ||
title: Crypto Attacks | ||
hide: true | ||
title: Infrastructure Resilience | ||
navHideLink: true | ||
navShowPages: true | ||
bookCollapseSection: true | ||
weight: 20 | ||
--- |
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,5 +1,5 @@ | ||
--- | ||
title: "Wiki" | ||
hide: true | ||
navHideLink: true | ||
navShowPages: true | ||
--- |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: Education | ||
navShowPages: true | ||
weight: 30 | ||
draft: true | ||
--- |
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
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,4 +1,5 @@ | ||
--- | ||
title: Oracles | ||
draft: true | ||
navHide: true | ||
--- |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
{{ define "taxonomies" }} | ||
{{ $page := .page }} | ||
{{ $section := .item }} | ||
{{ $path := .path }} | ||
{{ $level := add .level 1 }} | ||
|
||
{{ range $taxonomy, $terms := site.Taxonomies }} | ||
{{ with site.GetPage $taxonomy }} | ||
{{ if (hasPrefix .RelPermalink $section.RelPermalink) }} | ||
{{ $showTerms := .Params.navShowTerms | default false }} | ||
|
||
<li class="taxonomy {{ if $showTerms }}collapsible{{ end }}"> | ||
<h{{ $level }}>{{ partial "docs/menu-anchor" (dict "page" $page "item" . "showControls" $showTerms) }}</h{{ $level }}> | ||
|
||
{{ if $showTerms }} | ||
{{ with $terms }} | ||
{{ $name := .LinkTitle | urlize | lower }} | ||
{{ $path = printf "%s-%s" $path $name }} | ||
{{ $id := printf "ul%d-%s" $level $path }} | ||
|
||
<ul class="terms collapsible-target" id="{{ $id }}"> | ||
{{ range . }} | ||
<li>{{ partial "docs/menu-anchor" (dict "page" $page "item" .Page) }}</li> | ||
{{ end }} | ||
</ul> | ||
{{ end }} | ||
{{ end }} | ||
</li> | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ define "menu" }} | ||
{{ $page := .page }} | ||
{{ $path := .path }} | ||
{{ $level := add .level 1 }} | ||
|
||
{{ $name := "" }} | ||
{{ $id := "" }} | ||
{{ $expand := "" }} | ||
|
||
{{ $name = .LinkTitle | urlize | lower }} | ||
|
||
{{ if $path }} | ||
{{ $path = printf "%s-%s" $path $name }} | ||
{{ else }} | ||
{{ $path = $name }} | ||
{{ end }} | ||
|
||
{{ $id = printf "ul%d-%s" $level $path }} | ||
|
||
{{ $showPages := (and (.item.Param "navShowPages") (gt (.item.Pages | len) 0)) | default false }} | ||
{{ $showTaxonomies := .item.Param "navShowTaxonomies" | default false }} | ||
{{ $expand = (or $showPages $showTaxonomies) | default false }} | ||
|
||
<li class="li-h{{ $level }} {{ if $expand }}collapsible{{ end }}"> | ||
<h{{ $level }}>{{ partial "docs/menu-anchor" (dict "page" $page "item" .item "showControls" $expand) }}</h{{ $level }}> | ||
|
||
{{ if $showTaxonomies }} | ||
<ul class="taxonomies collapsible-target" id="{{ $id }}"> | ||
{{ template "taxonomies" (dict "page" $page "item" .item "level" $level "path" $path) }} | ||
</ul> | ||
{{ end }} | ||
|
||
{{ if $showPages }} | ||
<ul class="pages collapsible-target" id="{{ $id }}"> | ||
{{ range .item.Pages }} | ||
{{ template "menu" (dict "page" $page "item" . "level" $level "path" $path) }} | ||
{{ end }} | ||
</ul> | ||
{{ end }} | ||
</li> | ||
{{ end }} | ||
|
||
<ul class="book-tree"> | ||
{{ range site.Home.Pages }} | ||
{{ if not (.Param "navHide") }} | ||
{{ template "menu" (dict "page" . "item" . "level" 1 "path" "") }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ with site.Menus.external }} | ||
<li class="li-h2 external-links"> | ||
<h2>External</h2> | ||
{{ partial "docs/menu-hugo" . }} | ||
</li> | ||
{{ end }} | ||
</ul> | ||
|
||
<script type="module"> | ||
import Collapsible from "/js/collapsible.js" | ||
|
||
const sections = document.querySelectorAll(".collapsible") | ||
|
||
sections.forEach((item) => { | ||
const control = item.querySelector(".collapsible-control") | ||
const target = item.querySelector(".collapsible-target") | ||
|
||
new Collapsible({ | ||
control: control, | ||
target: { | ||
element: target, | ||
}, | ||
aria: { | ||
expanded: true, | ||
controls: true | ||
}, | ||
debug: false | ||
}) | ||
}) | ||
</script> |
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