From 38a1fa7002ef08e761cf52b8b2b005bc7a9c11f8 Mon Sep 17 00:00:00 2001 From: Rafael-gc Date: Wed, 3 Jul 2024 13:34:04 -0300 Subject: [PATCH 1/4] Add accordions to docs menu Signed-off-by: Rafael-gc --- site/layouts/partials/tree.html | 128 ++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 54 deletions(-) diff --git a/site/layouts/partials/tree.html b/site/layouts/partials/tree.html index 6c00cd7c7..7da47501f 100644 --- a/site/layouts/partials/tree.html +++ b/site/layouts/partials/tree.html @@ -1,61 +1,81 @@
- -
    -{{- $here := .dir }} -{{- range (readDir $here) }} - {{ if in .Name "image" }} - {{ else }} - {{- $fullPath := (printf "%s%s" $here .Name) }} - {{- $fullUrl := replace $fullPath "/content" "" }} - {{- $stat := os.Stat $fullPath }} - {{ if $stat.IsDir }} - {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" 1 }} - {{ end }} - {{ end }} -{{- end -}} -
-
-{{ define "treemenu" }} - {{ $nextDepth := add .depth 1 }} - {{- $activeLink := $.root.Permalink }} - {{- $className := "" }} - {{- $deprecated := true }} - {{- with $.root.Site.GetPage .url }} - {{- if not .Params.deprecated }} - {{- $deprecated = false }} - {{- $branchLink := .Permalink }} - {{- if in $activeLink $branchLink }} - {{- $className = "tree-branch-active" -}} - {{ end }} - {{- if eq $activeLink $branchLink }} - {{- $className = "tree-active tree-branch-active" -}} - {{- end -}} -
  • - {{ .Title }} - {{- end }} - {{- end }} - {{- if not $deprecated }} -
      - {{- range (readDir .path) }} - {{- if in .Name "image" | or (eq .Name "_index.md") }} - {{- else }} - {{- $fullPath := (printf "%s/%s" $.path .Name) }} + +
        + {{- $here := .dir }} + {{- range (readDir $here) }} + {{- if not (in .Name "image") }} + {{- $fullPath := (printf "%s%s" $here .Name) }} {{- $fullUrl := replace $fullPath "/content" "" }} - {{- $fullUrl = replace $fullUrl ".md" "" }} {{- $stat := os.Stat $fullPath }} {{- if $stat.IsDir }} - {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" $nextDepth }} - {{- else }} - {{- with $.root.Site.GetPage $fullUrl }} - {{- $link := printf "%s" .Permalink }} - - {{ .Title }} - - {{- end }} + {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" 1 }} {{- end }} {{- end }} {{- end }} -
      - - {{- end }} -{{ end }} \ No newline at end of file +
    + + +{{ define "treemenu" }} + {{ $nextDepth := add .depth 1 }} + {{ $activeLink := $.root.Permalink }} + {{ $className := "" }} + {{ $deprecated := true }} + {{ with $.root.Site.GetPage .url }} + {{ if not .Params.deprecated }} + {{ $deprecated = false }} + {{ $branchLink := .Permalink }} + {{ if in $activeLink $branchLink }} + {{ $className = "tree-branch-active" }} + {{ end }} + {{ if eq $activeLink $branchLink }} + {{ $className = "tree-active tree-branch-active" }} + {{ end }} +
  • + {{ .Title }} + {{ if lt $.depth 3 }} + + {{ end }} +
  • + {{ end }} + {{ end }} +{{ end }} + \ No newline at end of file From 33b684be977eefdaa2db31eae28d48ffcf39f5b6 Mon Sep 17 00:00:00 2001 From: Rafael-gc Date: Wed, 3 Jul 2024 20:21:27 -0300 Subject: [PATCH 2/4] Signed-off-by: Rafael-gc --- site/layouts/partials/tree.html | 144 ++++++++++++++++++++------------ 1 file changed, 92 insertions(+), 52 deletions(-) diff --git a/site/layouts/partials/tree.html b/site/layouts/partials/tree.html index 7da47501f..3376665c2 100644 --- a/site/layouts/partials/tree.html +++ b/site/layouts/partials/tree.html @@ -3,79 +3,119 @@
      {{- $here := .dir }} {{- range (readDir $here) }} - {{- if not (in .Name "image") }} + {{ if in .Name "image" }} + {{ else }} {{- $fullPath := (printf "%s%s" $here .Name) }} {{- $fullUrl := replace $fullPath "/content" "" }} {{- $stat := os.Stat $fullPath }} - {{- if $stat.IsDir }} + {{ if $stat.IsDir }} {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" 1 }} - {{- end }} - {{- end }} - {{- end }} + {{ end }} + {{ end }} + {{- end -}}
    {{ define "treemenu" }} {{ $nextDepth := add .depth 1 }} - {{ $activeLink := $.root.Permalink }} - {{ $className := "" }} - {{ $deprecated := true }} - {{ with $.root.Site.GetPage .url }} - {{ if not .Params.deprecated }} - {{ $deprecated = false }} - {{ $branchLink := .Permalink }} - {{ if in $activeLink $branchLink }} - {{ $className = "tree-branch-active" }} - {{ end }} - {{ if eq $activeLink $branchLink }} - {{ $className = "tree-active tree-branch-active" }} + {{- $activeLink := $.root.Permalink }} + {{- $className := "" }} + {{- $deprecated := true }} + {{- with $.root.Site.GetPage .url }} + {{- if not .Params.deprecated }} + {{- $deprecated = false }} + {{- $branchLink := .Permalink }} + {{- if in $activeLink $branchLink }} + {{- $className = "tree-branch-active" -}} {{ end }} + {{- if eq $activeLink $branchLink }} + {{- $className = "tree-active tree-branch-active" -}} + {{- end -}}
  • {{ .Title }} - {{ if lt $.depth 3 }} - - {{ end }} -
  • - {{ end }} - {{ end }} + {{- end }} + {{- end }} + {{- if not $deprecated }} + + + {{- end }} {{ end }} + \ No newline at end of file + From cf03d1eb2a14d139a234c12e335cf568ce445289 Mon Sep 17 00:00:00 2001 From: Rafael-gc Date: Sun, 14 Jul 2024 19:30:17 -0300 Subject: [PATCH 3/4] Change logic of the navigation tree Signed-off-by: Rafael-gc --- site/layouts/partials/tree.html | 56 +++++++++++++++++---------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/site/layouts/partials/tree.html b/site/layouts/partials/tree.html index 3376665c2..0bf914772 100644 --- a/site/layouts/partials/tree.html +++ b/site/layouts/partials/tree.html @@ -32,7 +32,8 @@ {{- $className = "tree-active tree-branch-active" -}} {{- end -}}
  • - {{ .Title }} + [+] + {{ .Title }} {{- end }} {{- end }} {{- if not $deprecated }} @@ -61,26 +62,25 @@ {{- end }} {{ end }} + + + \ No newline at end of file From 42ec505c91f0c0dd52cb50560b67c2956da4f8d0 Mon Sep 17 00:00:00 2001 From: Rafael-gc Date: Mon, 2 Sep 2024 14:54:08 -0300 Subject: [PATCH 4/4] Signed-off-by: Rafael-gc --- site/layouts/partials/tree.html | 95 ++++++++++++--------------------- 1 file changed, 34 insertions(+), 61 deletions(-) diff --git a/site/layouts/partials/tree.html b/site/layouts/partials/tree.html index 0bf914772..e5a1f5fce 100644 --- a/site/layouts/partials/tree.html +++ b/site/layouts/partials/tree.html @@ -3,13 +3,13 @@
      {{- $here := .dir }} {{- range (readDir $here) }} - {{ if in .Name "image" }} + {{ if in .Name "image" | or (eq .Name "_index.md") }} {{ else }} {{- $fullPath := (printf "%s%s" $here .Name) }} {{- $fullUrl := replace $fullPath "/content" "" }} {{- $stat := os.Stat $fullPath }} {{ if $stat.IsDir }} - {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" 1 }} + {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" 1 "expand" false }} {{ end }} {{ end }} {{- end -}} @@ -21,23 +21,18 @@ {{- $activeLink := $.root.Permalink }} {{- $className := "" }} {{- $deprecated := true }} + {{- $expand := .expand }} {{- with $.root.Site.GetPage .url }} {{- if not .Params.deprecated }} {{- $deprecated = false }} {{- $branchLink := .Permalink }} - {{- if in $activeLink $branchLink }} - {{- $className = "tree-branch-active" -}} - {{ end }} - {{- if eq $activeLink $branchLink }} - {{- $className = "tree-active tree-branch-active" -}} - {{- end -}}
    • - [+] {{ .Title }} {{- end }} {{- end }} + {{- if not $deprecated }} -