From e98fba9f2779da63f4ddc64f8c8006c9933e8c51 Mon Sep 17 00:00:00 2001 From: alexisben <alex@noesya.coop> Date: Fri, 16 Dec 2022 11:21:17 +0100 Subject: [PATCH] program toc --- layouts/partials/diplomas/hero-single.html | 2 +- layouts/partials/programs/hero-single.html | 2 +- layouts/partials/programs/toc.html | 62 +++++++++++++++++++--- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/layouts/partials/diplomas/hero-single.html b/layouts/partials/diplomas/hero-single.html index abe6f4f9..9f5cb668 100644 --- a/layouts/partials/diplomas/hero-single.html +++ b/layouts/partials/diplomas/hero-single.html @@ -24,7 +24,7 @@ {{ end -}} </div> </div> - <div id="essential"> + <div id="#{{ anchorize (i18n "programs.toc.essential") }}"> <div class="container"> {{- partial "diplomas/essential" . -}} </div> diff --git a/layouts/partials/programs/hero-single.html b/layouts/partials/programs/hero-single.html index 5d56d7a0..4df408f6 100644 --- a/layouts/partials/programs/hero-single.html +++ b/layouts/partials/programs/hero-single.html @@ -9,7 +9,7 @@ </div> </div> - <div id="essential"> + <div id="#{{ anchorize (i18n "programs.toc.essential") }}"> <div class="container"> {{- partial "programs/essential" . -}} <div class="buttons"> diff --git a/layouts/partials/programs/toc.html b/layouts/partials/programs/toc.html index c880a04e..a8cc8e5d 100644 --- a/layouts/partials/programs/toc.html +++ b/layouts/partials/programs/toc.html @@ -1,35 +1,85 @@ -{{ $pedagogy := (dict +{{ $content := partial "GetTextFromHTML" .context.Params.content}} +{{ $pedagogy := partial "GetTextFromHTML" .context.Params.pedagogy }} +{{ $evaluation := partial "GetTextFromHTML" .context.Params.evaluation }} +{{ $teachers := partial "GetTextFromHTML" .context.Params.teachers }} - )}} +{{ $opportunities := partial "GetTextFromHTML" .context.Params.opportunities }} +{{ $results := partial "GetTextFromHTML" .context.Params.results }} + +{{ $prerequisites := partial "GetTextFromHTML" .context.Params.prerequisites }} +{{ $pricing := partial "GetTextFromHTML" .context.Params.pricing }} +{{ $registration := partial "GetTextFromHTML" .context.Params.registration }} +{{ $accessibility := partial "GetTextFromHTML" .context.Params.accessibility }} +{{ $other := partial "GetTextFromHTML" .context.Params.other }} {{/* nav-link required for toggle active class */}} <nav class="toc" id="nav-toc" aria-label="{{ i18n "commons.toc" }}"> <ol> <li> - <a href="#essential">{{ i18n "programs.toc.essential" }}</a> + <a href="#{{ anchorize (i18n "programs.toc.essential") }}">{{ i18n "programs.toc.essential" }}</a> </li> <li> - <a href="#presentation">{{ i18n "programs.toc.presentation" }}</a> + <a href="#{{ anchorize (i18n "programs.toc.presentation") }}">{{ i18n "programs.toc.presentation" }}</a> <ol> <li><a href="#{{ anchorize (i18n "programs.administrative_information") }}">{{ i18n "programs.administrative_information" }}</a></li> {{- if .context.Params.blocks -}} - {{- partial "blocks/toc" .context.Params.blocks -}} + {{- partial "blocks/toc" .context.Params.blocks -}} {{- end -}} </ol> </li> <li> <a href="#pedagogy">{{ i18n "programs.toc.pedagogy" }}</a> + {{- if or $content $pedagogy $evaluation $teachers }} <ol> - {{- if partial "GetTextFromHTML" .context.Params.content -}} + {{- if $content -}} <li><a href="#{{ anchorize (i18n "programs.content") }}">{{ i18n "programs.content" }}</a></li> {{- end -}} + {{- if $pedagogy -}} + <li><a href="#{{ anchorize (i18n "programs.pedagogy") }}">{{ i18n "programs.pedagogy" }}</a></li> + {{- end -}} + {{- if $evaluation -}} + <li><a href="#{{ anchorize (i18n "programs.evaluation") }}">{{ i18n "programs.evaluation" }}</a></li> + {{- end -}} + {{- if $teachers -}} + <li><a href="#{{ anchorize (i18n "programs.teachers") }}">{{ i18n "programs.evaluation" }}</a></li> + {{- end -}} </ol> + {{ end -}} </li> <li> <a href="#results">{{ i18n "programs.toc.results" }}</a> + {{- if or $opportunities $results }} + <ol> + {{- if $opportunities -}} + <li><a href="#{{ anchorize (i18n "programs.opportunities") }}">{{ i18n "programs.opportunities" }}</a></li> + {{- end -}} + {{- if $results -}} + <li><a href="#{{ anchorize (i18n "programs.results") }}">{{ i18n "programs.results" }}</a></li> + {{- end -}} + </ol> + {{ end -}} </li> <li> <a href="#admission">{{ i18n "programs.toc.admission" }}</a> + {{- if or $prerequisites $pricing $registration $accessibility $other }} + <ol> + {{- if $prerequisites -}} + <li><a href="#{{ anchorize (i18n "programs.prerequisites") }}">{{ i18n "programs.prerequisites" }}</a></li> + {{- end -}} + {{- if $pricing -}} + <li><a href="#{{ anchorize (i18n "programs.pricing") }}">{{ i18n "programs.pricing" }}</a></li> + {{- end -}} + {{- if $registration -}} + <li><a href="#{{ anchorize (i18n "programs.registration") }}">{{ i18n "programs.registration" }}</a></li> + {{- end -}} + {{- if $accessibility -}} + <li><a href="#{{ anchorize (i18n "programs.accessibility") }}">{{ i18n "programs.accessibility" }}</a></li> + {{- end -}} + {{- if $other -}} + <li><a href="#{{ anchorize (i18n "programs._other") }}">{{ i18n "programs._other" }}</a></li> + {{- end -}} + </ol> + {{ end -}} </li> </ol> </nav> -- GitLab