diff --git a/assets/js/theme/design-system/mainMenu.js b/assets/js/theme/design-system/mainMenu.js index de92c93bc543c6e199359fb6d456610883d3176b..217a017bcbb2e1441f887a54ba3d833e23e8ee20 100644 --- a/assets/js/theme/design-system/mainMenu.js +++ b/assets/js/theme/design-system/mainMenu.js @@ -159,4 +159,4 @@ class MainMenu { } } -export default new MainMenu('header[role="banner"]'); +export default new MainMenu('header#document-header'); diff --git a/assets/js/theme/design-system/toc.js b/assets/js/theme/design-system/toc.js index d95de462b7079ddddd01de3cd6459ea1a3d87ea6..50a9f797ea4352486a17aaa494afc0745a130329 100644 --- a/assets/js/theme/design-system/toc.js +++ b/assets/js/theme/design-system/toc.js @@ -4,7 +4,8 @@ const CLASSES = { offcanvasOpened: 'has-offcanvas-opened', linkActive: 'active', isOpened: 'is-opened', - fullWidth: 'full-width' + fullWidth: 'full-width', + offcanvas: 'offcanvas-toc' }; class TableOfContents { @@ -13,22 +14,23 @@ class TableOfContents { this.content = this.element.querySelector('.toc-content'); this.nav = this.element.querySelector('.toc'); this.links = this.element.querySelectorAll('a'); - this.sections = document.querySelectorAll('section'); + this.sections = document.querySelectorAll('section[id]'); // TODO : handle sublinks update in toc this.ctaTitle = document.querySelector('.toc-cta-title span'); this.togglers = document.querySelectorAll('.toc-cta button, .toc-container button'); this.state = { opened: false, - currentId: null + currentId: null, + currentLink: 0 } this.listen(); if (this.isOffcanvas) { - this.element.setAttribute("aria-expanded", false); + this.element.setAttribute("aria-hidden", true); } } isOffcanvas() { - return isMobile() || document.body.classList.contains(CLASSES.fullWidth); + return isMobile() || document.body.classList.contains(CLASSES.fullWidth) || document.body.classList.contains(CLASSES.offcanvas); } listen() { window.addEventListener('scroll', this.update.bind(this), false); @@ -64,12 +66,12 @@ class TableOfContents { // TODO: refacto timeout and css transition setTimeout(() => { - this.element.setAttribute("aria-expanded", this.state.opened); + this.element.setAttribute("aria-hidden", !this.state.opened); }, transitionDuration * 1000); setTimeout(() => { this.element.classList[classAction](CLASSES.isOpened); - }, 10) + }, 50) document.documentElement.classList[classAction](CLASSES.offcanvasOpened); } @@ -82,7 +84,7 @@ class TableOfContents { const scroll = document.documentElement.scrollTop || document.body.scrollTop; let id = null; this.sections.forEach(section => { - if (section.offsetTop <= scroll) { + if (this.getAbsoluteOffsetTop(section) <= scroll + window.innerHeight/2) { id = section.id; } }); @@ -92,14 +94,27 @@ class TableOfContents { } this.updateScrollspy(scroll); } + getAbsoluteOffsetTop(element) { + let top = 0; + do { + top += element.offsetTop || 0; + element = element.offsetParent; + } while(element); + return top + } activateLink(id) { const currentLink = this.element.querySelector(`[href*=${ id }]`); - this.state.id = id; - this.links.forEach(link => link.classList.remove(CLASSES.linkActive)); - if (currentLink) { - currentLink.classList.add(CLASSES.linkActive); - this.updateCtaTitle(currentLink); - } + // console.log(currentLink.hash) + this.links.forEach((link, index) => { + if (link == currentLink) { + link.classList.add(CLASSES.linkActive); + this.updateCtaTitle(link); + this.state.id = id; + this.state.currentLink = link; + } else { + link.classList.remove(CLASSES.linkActive) + } + }); } updateCtaTitle(link) { if (isMobile()) { @@ -109,10 +124,14 @@ class TableOfContents { } } updateScrollspy(scroll) { - const progression = Math.max((scroll - window.innerHeight) / document.body.offsetHeight, 0); const container = this.isOffcanvas() ? this.nav : this.content; - // TODO: ne fonctionne pas avec le behavior-scroll: smooth - container.scrollTop = progression * window.innerHeight/2; + if (this.state.currentLink) { + let progress = (this.getAbsoluteOffsetTop(this.state.currentLink) - container.offsetHeight/2); + progress = this.isOffcanvas() ? progress : progress - scroll; + container.scrollTo({ + top: progress + }) + } } } diff --git a/assets/sass/_theme/design-system/footer.sass b/assets/sass/_theme/design-system/footer.sass index 9512a5125ae12a77c7f9803a235b017deb1615a1..3f30abab743d6e40cc74905571cacdf01e739d24 100644 --- a/assets/sass/_theme/design-system/footer.sass +++ b/assets/sass/_theme/design-system/footer.sass @@ -1,4 +1,4 @@ -footer[role="contentinfo"] +footer#document-footer background: $footer-background-color color: $footer-color padding-bottom: $spacing3 diff --git a/assets/sass/_theme/design-system/header.sass b/assets/sass/_theme/design-system/header.sass index 3119604fb49c4e261b739835c25f8de58b00b49c..c5770e2aeea36059e2caa5a5062aef7836d6a3fe 100644 --- a/assets/sass/_theme/design-system/header.sass +++ b/assets/sass/_theme/design-system/header.sass @@ -1,4 +1,4 @@ -header[role="banner"] +header#document-header background: $header-background border-bottom: 1px solid $color-border color: $header-color @@ -48,7 +48,7 @@ header[role="banner"] height: $header-logo-height-desktop @include media-breakpoint-down(desktop) html.has-menu-opened & - nav[role="navigation"] + nav padding-bottom: 0 // TODO : Est-ce au bon endroit ? body @@ -76,8 +76,8 @@ body display: block opacity: 0 -header[role="banner"] - nav[role="navigation"] +header#document-header + nav padding-top: $header-nav-padding-y padding-bottom: $header-nav-padding-y .container diff --git a/assets/sass/_theme/design-system/hero.sass b/assets/sass/_theme/design-system/hero.sass index edc24bca4187ca814c8ae6e9564c7901e26c082c..fa27327656cc8b998299014f6ce36edfc08767bc 100644 --- a/assets/sass/_theme/design-system/hero.sass +++ b/assets/sass/_theme/design-system/hero.sass @@ -21,6 +21,7 @@ h1 + p margin-top: $spacing1 figure + position: relative &, img, picture display: block figcaption @@ -29,6 +30,37 @@ a color: inherit + position: absolute + display: block + left: 0 + right: 0 + z-index: 10 + p + @include meta + &::before + @include meta + content: '©' + position: absolute + right: 0 + top: 0 + background: $color-background-alt + text-align: center + line-height: px2rem(30) + width: px2rem(30) + height: px2rem(30) + display: block + p + background: $color-background-alt + display: none + padding: half($spacing0) + padding-right: $spacing2 + &:focus + p + display: block + &:hover + figcaption p + display: block + // TODO : handle hero with image // @if $breadcrumb-below-h1 // .container:first-child @@ -40,37 +72,6 @@ // order: 3 // margin-top: $spacing3 - figure - position: relative - figcaption - position: absolute - display: block - left: 0 - right: 0 - z-index: 10 - &::before - content: '©' - position: absolute - right: 0 - top: 0 - background: $color-background-alt - text-align: center - line-height: px2rem(30) - width: px2rem(30) - height: px2rem(30) - display: block - p - background: $color-background-alt - display: none - padding: half($spacing0) - padding-right: $spacing2 - &:focus - p - display: block - &:hover - figcaption p - display: block - @include media-breakpoint-down(desktop) &--with-image padding-bottom: 0 diff --git a/assets/sass/_theme/design-system/table_of_contents.sass b/assets/sass/_theme/design-system/table_of_contents.sass index 9ef62263645be27d17bc9dd0bd2cec0ddc00b2c2..75c6d9d1bf5b483c937fb525e5c70f7f8821ca32 100644 --- a/assets/sass/_theme/design-system/table_of_contents.sass +++ b/assets/sass/_theme/design-system/table_of_contents.sass @@ -14,7 +14,7 @@ width: calc(100% - #{$grid-gutter}) &.is-opened transform: translateX(0) - &[aria-expanded="false"] + &[aria-hidden="true"] display: none .toc-content display: flex diff --git a/assets/sass/_theme/sections/programs.sass b/assets/sass/_theme/sections/programs.sass index 9663e9019398d5ae911ceac03232b237b1875a4f..29d11181c20e261154e1640f28fd47700d42a7da 100644 --- a/assets/sass/_theme/sections/programs.sass +++ b/assets/sass/_theme/sections/programs.sass @@ -83,9 +83,11 @@ ol.programs .document-content .content padding-bottom: $spacing2 - > div > * + * + section > * + * margin-top: 1em .blocks + h3 + @include h3 @include media-breakpoint-down(desktop) margin-left: half(-$grid-gutter-sm) margin-right: half(-$grid-gutter-sm) @@ -113,8 +115,9 @@ ol.programs align-self: start grid-column: 1/5 margin-bottom: 0 - h3:not(:first-of-type) + section:not(:first-of-type) margin-top: $spacing4 + section:first-of-type .content border-top: none diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a9abb019ec42df8d0ba47d9059317647f3ab5b79..a9459f1b2ec1d509dac4b959f384955c09a06d6f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -16,7 +16,7 @@ <body class="{{ $body_class }}"> {{- partial "header/accessibility.html" -}} {{- partial "header/header.html" -}} - <main{{ if .Params.blocks }} class="page-with-blocks"{{ end }} id="main" role="main" tabindex="-1"> + <main{{ if .Params.blocks }} class="page-with-blocks"{{ end }} id="main" tabindex="-1"> {{- block "main" . }}{{- end }} {{- partial "hooks/before-main-end" . -}} </main> diff --git a/layouts/partials/ToCamelCase b/layouts/partials/ToCamelCase new file mode 100644 index 0000000000000000000000000000000000000000..44702344eeee4b96b23108b40591bee0a7fac65d --- /dev/null +++ b/layouts/partials/ToCamelCase @@ -0,0 +1,4 @@ +{{ $input := . }} +{{ $output := $input | lower }} +{{ $output := $output | markdownify }} +{{ return $output }} \ No newline at end of file diff --git a/layouts/partials/blocks/templates/posts.html b/layouts/partials/blocks/templates/posts.html index 27ac3fca676627a3ca2fbd8c4666476e8dc9c9ba..67de4bd4dea24887db5816bd1ce813366ecdbb09 100644 --- a/layouts/partials/blocks/templates/posts.html +++ b/layouts/partials/blocks/templates/posts.html @@ -10,7 +10,7 @@ {{ if .category }} {{- $term = site.GetPage (printf "/categories%s" .category) -}} {{ end }} - <section class="block block-posts--{{- $layout }} block-posts{{ if $title }} block-with-title{{ end }} {{ if $term }} term-{{ replace $term.Slug "/" "" }} {{- end -}}" id="block-{{ $position }}"> + <section itemscope itemtype="http://schema.org/Blog" class="block block-posts--{{- $layout }} block-posts{{ if $title }} block-with-title{{ end }} {{ if $term }} term-{{ replace $term.Slug "/" "" }} {{- end -}}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{ if $title -}} diff --git a/layouts/partials/commons/menu.html b/layouts/partials/commons/menu.html index 58293e56081cfbba92df5a4efe8cd37fe32cace9..767c06198974698a0b7d258c95fbfa6f82b01cdb 100644 --- a/layouts/partials/commons/menu.html +++ b/layouts/partials/commons/menu.html @@ -30,7 +30,7 @@ {{- if ne .kind "blank" -}} <a href="{{ .target }}"{{ if ne $linkClass ""}} class="{{ $linkClass }}"{{ end }} {{ safeHTMLAttr $attr }} {{ safeHTMLAttr $attr_title }}>{{ .title }}</a> {{- else -}} - <span class="{{ if ne $linkClass ""}} {{ $linkClass }}{{ end }}{{ if gt .level 1 }} disabled{{ end }}"{{ safeHTMLAttr $attr }}>{{ .title }}</span> + <span class="{{ if ne $linkClass ""}} {{ $linkClass }}{{ end }}{{ if gt .level 1 }} disabled{{ end }}" {{ safeHTMLAttr $attr }}>{{ .title }}</span> {{- end -}} {{- if ne $stop $level -}} {{- if $hasDropdown }} diff --git a/layouts/partials/commons/pagination.html b/layouts/partials/commons/pagination.html index 05feef299621b654acf17021f1691a63f9339b63..8769cb92df6e931c4cf8f73d0a58a621b134f5a1 100644 --- a/layouts/partials/commons/pagination.html +++ b/layouts/partials/commons/pagination.html @@ -14,7 +14,7 @@ <!-- If there's more than one page. --> {{- if gt $paginator.TotalPages 1 -}} -<nav role="navigation" aria-label="{{ i18n "commons.pagination.label" }}"> +<nav aria-label="{{ i18n "commons.pagination.label" }}"> <ul class="pagination"> <!-- First page. --> diff --git a/layouts/partials/diplomas/hero-single.html b/layouts/partials/diplomas/hero-single.html index 9f5cb6688ab9951b01bc5fa2b3a0a4f0e0b344d1..69f7b939cb04140dea6cf9fa2762b85d46a5c682 100644 --- a/layouts/partials/diplomas/hero-single.html +++ b/layouts/partials/diplomas/hero-single.html @@ -24,7 +24,7 @@ {{ end -}} </div> </div> - <div id="#{{ anchorize (i18n "programs.toc.essential") }}"> + <div id="#{{ urlize (i18n "programs.toc.essential") }}"> <div class="container"> {{- partial "diplomas/essential" . -}} </div> diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html index f01359febbc98953e9b189f372a2d0c86b8e33a5..21183ce4fba865f7ba6c361de74049d086968d96 100644 --- a/layouts/partials/footer/footer.html +++ b/layouts/partials/footer/footer.html @@ -1,3 +1,3 @@ -<footer role="contentinfo"> +<footer id="document-footer"> {{ partial "footer/footer-simple.html" }} </footer> diff --git a/layouts/partials/header/header.html b/layouts/partials/header/header.html index b5e768c508f5fb76e47943baf243d05016386712..a37e6b1fd9f9681a3bf26540c4770d2acdd7c543 100644 --- a/layouts/partials/header/header.html +++ b/layouts/partials/header/header.html @@ -1,6 +1,5 @@ -<header role="banner"> - {{/* navbar class is required for dropdown */}} - <nav class="navbar" role="navigation" aria-label="{{ i18n "commons.menu.main" }}"> +<header id="document-header"> + <nav aria-label="{{ i18n "commons.menu.main" }}"> <div class="container"> {{ partial "header/logo.html" }} {{ if isset site.Data.menus "primary"}} diff --git a/layouts/partials/header/hero.html b/layouts/partials/header/hero.html index 57add4783c51ab3e830d8184fddd17c366dd3916..5f138ca2877da57ed7d4ad652428e290f3a98d27 100644 --- a/layouts/partials/header/hero.html +++ b/layouts/partials/header/hero.html @@ -17,7 +17,6 @@ {{- else -}} <h1>{{ partial "PrepareHTML" .title }}</h1> {{- end -}} - </hgroup> {{- if .image }} <figure> {{ partial "commons/image.html" diff --git a/layouts/partials/programs/admission.html b/layouts/partials/programs/admission.html index eb002289eaafa74a199b8382206c94136b93ae4e..50d5ec348d9344bfbf1e2af0a6510036c62efa21 100644 --- a/layouts/partials/programs/admission.html +++ b/layouts/partials/programs/admission.html @@ -1,72 +1,85 @@ {{- if or (partial "GetTextFromHTML" .Params.prerequisites) (partial "GetTextFromHTML" .Params.pricing) (partial "GetTextFromHTML" .Params.registration) (partial "GetTextFromHTML" .Params.accessibility) (partial "GetTextFromHTML" .Params.other) -}} -<section id="admission"> +<section id="{{ urlize (i18n "programs.toc.admission") }}"> <div class="container"> <div class="content"> <h2>{{ i18n "programs.toc.admission" }}</h2> <div> {{- if partial "GetTextFromHTML" .Params.prerequisites -}} - <h3>{{ i18n "programs.prerequisites" }}</h3> - {{- partial "PrepareHTML" .Params.prerequisites -}} + <section id="{{ urlize (i18n "programs.prerequisites") }}"> + <h3>{{ i18n "programs.prerequisites" }}</h3> + {{- partial "PrepareHTML" .Params.prerequisites -}} + </section> {{- end -}} {{- if partial "GetTextFromHTML" .Params.pricing -}} - <h3>{{ i18n "programs.pricing" }}</h3> - {{- partial "PrepareHTML" .Params.pricing -}} + <section id="{{ urlize (i18n "programs.pricing") }}"> + <h3>{{ i18n "programs.pricing" }}</h3> + {{- partial "PrepareHTML" .Params.pricing -}} + </section> {{- end -}} {{- if partial "GetTextFromHTML" .Params.registration -}} - <h3>{{ i18n "programs.registration" }}</h3> - {{- partial "PrepareHTML" .Params.registration -}} - {{- if partial "GetTextFromHTML" .Params.registration_url -}} - <p><a href="{{- partial "PrepareHTML" .Params.registration_url -}}" class="registration">{{ i18n "programs.apply" }}</a></p> - {{- end -}} + <section id="{{ urlize (i18n "programs.registration") }}"> + <h3>{{ i18n "programs.registration" }}</h3> + {{- partial "PrepareHTML" .Params.registration -}} + {{- if partial "GetTextFromHTML" .Params.registration_url -}} + <p><a href="{{- partial "PrepareHTML" .Params.registration_url -}}" class="registration">{{ i18n "programs.apply" }}</a></p> + {{- end -}} + </section> {{- end -}} {{- if partial "GetTextFromHTML" .Params.accessibility -}} - <h3>{{ i18n "programs.accessibility" }}</h3> - {{- partial "PrepareHTML" .Params.accessibility -}} + <section id="{{ urlize (i18n "programs.accessibility") }}"> + <h3>{{ i18n "programs.accessibility" }}</h3> + {{- partial "PrepareHTML" .Params.accessibility -}} + </section> {{- end -}} {{- if partial "GetTextFromHTML" .Params.other -}} - <h3>{{ i18n "programs._other" }}</h3> - {{- partial "PrepareHTML" .Params.other -}} + <section id="{{ urlize (i18n "programs._other") }}"> + <h3>{{ i18n "programs._other" }}</h3> + {{- partial "PrepareHTML" .Params.other -}} + </section> {{- end -}} {{- if .Params.roles -}} - - <h3>{{ i18n "programs.roles" }}</h3> - {{- with .Params.roles -}} - {{- range . }} - {{ $title := .title }} - {{- range .persons -}} - {{ $slug := . }} - {{ with site.GetPage "persons" }} - {{ with .GetPage $slug }} - <p> - <b>{{ $title }}</b> - <br> - <a href="{{ .Permalink }}">{{ partial "PrepareHTML" .Title }}</a> - {{ if .Params.phone }} - <br> - {{ safeHTML .Params.phone }} - {{ end }} - {{ if .Params.email }} + <section id="{{ urlize (i18n "programs.roles") }}"> + <h3>{{ i18n "programs.roles" }}</h3> + {{- with .Params.roles -}} + {{- range . }} + {{ $title := .title }} + {{- range .persons -}} + {{ $slug := . }} + {{ with site.GetPage "persons" }} + {{ with .GetPage $slug }} + <p> + <b>{{ $title }}</b> <br> - <a href="mailto:{{ .Params.email }}" rel="noreferrer" target="_blank">{{ .Params.email }}</a> - {{ end }} - </p> + <a href="{{ .Permalink }}">{{ partial "PrepareHTML" .Title }}</a> + {{ if .Params.phone }} + <br> + {{ safeHTML .Params.phone }} + {{ end }} + {{ if .Params.email }} + <br> + <a href="mailto:{{ .Params.email }}" rel="noreferrer" target="_blank">{{ .Params.email }}</a> + {{ end }} + </p> + {{ end }} {{ end }} {{ end }} - {{ end }} - {{ end -}} - {{- end -}} + {{ end -}} + {{- end -}} + </section> {{- end -}} - {{- if partial "GetTextFromHTML" .Params.contacts -}} - <h3>{{ i18n "programs.contacts" }}</h3> - {{- if or (partial "GetTextFromHTML" .Params.contacts) -}} - {{- partial "PrepareHTML" .Params.contacts -}} - {{- end -}} + {{- if partial "GetTextFromHTML" .Params.contacts -}} + <section id="{{ urlize (i18n "programs.contacts") }}"> + <h3>{{ i18n "programs.contacts" }}</h3> + {{- if or (partial "GetTextFromHTML" .Params.contacts) -}} + {{- partial "PrepareHTML" .Params.contacts -}} + {{- end -}} + </section> {{- end -}} </div> </div> diff --git a/layouts/partials/programs/hero-single.html b/layouts/partials/programs/hero-single.html index 4df408f6e6f7269514f556a71aa114b0e73ce57f..bd3de22920754fa768ea84d14718f75c91cf01e0 100644 --- a/layouts/partials/programs/hero-single.html +++ b/layouts/partials/programs/hero-single.html @@ -9,7 +9,7 @@ </div> </div> - <div id="#{{ anchorize (i18n "programs.toc.essential") }}"> + <div id="#{{ urlize (i18n "programs.toc.essential") }}"> <div class="container"> {{- partial "programs/essential" . -}} <div class="buttons"> diff --git a/layouts/partials/programs/pedagogy.html b/layouts/partials/programs/pedagogy.html index fcd6596fc92aa2c652b66113117bf3059e093640..fbc1bdf4f8597231098779166f79b9cf3cb1a5fc 100644 --- a/layouts/partials/programs/pedagogy.html +++ b/layouts/partials/programs/pedagogy.html @@ -1,33 +1,41 @@ {{- if or (partial "GetTextFromHTML" .Params.content) (partial "GetTextFromHTML" .Params.pedagogy) (partial "GetTextFromHTML" .Params.evaluation) (.Params.teachers) -}} -<section id="pedagogy"> +<section id="{{ urlize ( i18n "programs.toc.pedagogy" ) }}"> <div class="container"> <div class="content"> <h2>{{ i18n "programs.toc.pedagogy" }}</h2> <div> {{- if partial "GetTextFromHTML" .Params.content -}} - <h3 id="{{ anchorize (i18n "programs.content") }}">{{ i18n "programs.content" }}</h3> - {{- partial "PrepareHTML" .Params.content -}} + <section id="{{ urlize (i18n "programs.content") }}"> + <h3>{{ i18n "programs.content" }}</h3> + {{- partial "PrepareHTML" .Params.content -}} + </section> {{- end -}} {{- if partial "GetTextFromHTML" .Params.pedagogy -}} - <h3 id="{{ anchorize (i18n "programs.pedagogy") }}">{{ i18n "programs.pedagogy" }}</h3> - {{- partial "PrepareHTML" .Params.pedagogy -}} + <section id="{{ urlize (i18n "programs.pedagogy") }}"> + <h3>{{ i18n "programs.pedagogy" }}</h3> + {{- partial "PrepareHTML" .Params.pedagogy -}} + </section> {{- end -}} {{- if partial "GetTextFromHTML" .Params.evaluation -}} - <h3 id="{{ anchorize (i18n "programs.evaluation") }}">{{ i18n "programs.evaluation" }}</h3> - {{- partial "PrepareHTML" .Params.evaluation -}} + <section id="{{ urlize (i18n "programs.evaluation") }}"> + <h3>{{ i18n "programs.evaluation" }}</h3> + {{- partial "PrepareHTML" .Params.evaluation -}} + </section> {{- end -}} {{- if .Params.teachers -}} {{ $title := i18n "programs.teachers" -}} - <h3 id="{{ anchorize $title }}">{{ $title }}</h3> - {{- partial "programs/teachers.html" - (dict - "title" $title - "teachers" .Params.teachers - "descriptions" .Params.teachers_description - ) -}} + <section id="{{ urlize $title }}"> + <h3>{{ $title }}</h3> + {{- partial "programs/teachers.html" + (dict + "title" $title + "teachers" .Params.teachers + "descriptions" .Params.teachers_description + ) -}} + </section> {{- end -}} </div> </div> diff --git a/layouts/partials/programs/presentation.html b/layouts/partials/programs/presentation.html index 025f36c1c1b132d59482bc503baee65bed8dfc5c..ac4b5f030c2c97318d599bbda6293d8144c41aa9 100644 --- a/layouts/partials/programs/presentation.html +++ b/layouts/partials/programs/presentation.html @@ -1,4 +1,4 @@ -<section id="presentation"> +<section id="{{ urlize (i18n "programs.toc.presentation") }}"> <div class="container"> <div class="content"> <h2>{{ i18n "programs.toc.presentation" }}</h2> @@ -9,39 +9,41 @@ {{- partial "PrepareHTML" .Params.objectives -}} {{- end -}} - <h3 id="{{ anchorize (i18n "programs.administrative_information") }}">{{ i18n "programs.administrative_information" }}</h3> - <table class="post-infos"> - <caption>{{ i18n "programs.administrative_information" }}</caption> - <tbody> - {{- with .Params.diplomas -}} - {{- $diploma := site.GetPage (printf "/diplomas/%s" .) -}} - {{- with $diploma.Params.ects -}} - <tr> - <th>{{ i18n "programs.ects_credits" }}</th> - <td>{{ partial "PrepareHTML" . }}</td> - </tr> + <section id="{{ urlize (i18n "programs.administrative_information") }}"> + <h3>{{ i18n "programs.administrative_information" }}</h3> + <table class="post-infos"> + <caption>{{ i18n "programs.administrative_information" }}</caption> + <tbody> + {{- with .Params.diplomas -}} + {{- $diploma := site.GetPage (printf "/diplomas/%s" .) -}} + {{- with $diploma.Params.ects -}} + <tr> + <th>{{ i18n "programs.ects_credits" }}</th> + <td>{{ partial "PrepareHTML" . }}</td> + </tr> + {{- end -}} {{- end -}} - {{- end -}} - <tr> - <th>{{ i18n "programs.type.initial" }}</th> - <td>{{ if .Params.initial }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> - </tr> - <tr> - <th>{{ i18n "programs.type.continuing" }}</th> - <td>{{ if .Params.continuing }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> - </tr> - <tr> - <th>{{ i18n "programs.type.apprenticeship" }}</th> - <td>{{ if .Params.apprenticeship }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> - </tr> - {{- if partial "GetTextFromHTML" .Params.capacity -}} - <tr> - <th>{{ i18n "programs.capacity" }}</th> - <td>{{ partial "PrepareHTML" .Params.capacity }}</td> - </tr> - {{- end -}} - </tbody> - </table> + <tr> + <th>{{ i18n "programs.type.initial" }}</th> + <td>{{ if .Params.initial }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> + </tr> + <tr> + <th>{{ i18n "programs.type.continuing" }}</th> + <td>{{ if .Params.continuing }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> + </tr> + <tr> + <th>{{ i18n "programs.type.apprenticeship" }}</th> + <td>{{ if .Params.apprenticeship }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> + </tr> + {{- if partial "GetTextFromHTML" .Params.capacity -}} + <tr> + <th>{{ i18n "programs.capacity" }}</th> + <td>{{ partial "PrepareHTML" .Params.capacity }}</td> + </tr> + {{- end -}} + </tbody> + </table> + </section> </div> {{- partial "blocks/list.html" . }} diff --git a/layouts/partials/programs/results.html b/layouts/partials/programs/results.html index 09eb2e7077c8872ec950b9997b591b2a0c8a32eb..2ebb05daf7e71a452db76895b57d999fe7c61de0 100644 --- a/layouts/partials/programs/results.html +++ b/layouts/partials/programs/results.html @@ -1,17 +1,21 @@ {{- if or (partial "GetTextFromHTML" .Params.opportunities) (partial "GetTextFromHTML" .Params.results) -}} -<section id="results"> +<section id="{{ urlize ( i18n "programs.toc.results" ) }}"> <div class="container"> <div class="content"> <h2>{{ i18n "programs.toc.results" }}</h2> <div> {{- if partial "GetTextFromHTML" .Params.opportunities -}} - <h3>{{ i18n "programs.opportunities" }}</h3> - {{- partial "PrepareHTML" .Params.opportunities -}} + <section id="{{ urlize (i18n "programs.opportunities") }}"> + <h3>{{ i18n "programs.opportunities" }}</h3> + {{- partial "PrepareHTML" .Params.opportunities -}} + </section> {{- end -}} {{- if partial "GetTextFromHTML" .Params.results -}} - <h3>{{ i18n "programs.results" }}</h3> - {{- partial "PrepareHTML" .Params.results -}} + <section id="{{ urlize (i18n "programs.results") }}"> + <h3>{{ i18n "programs.results" }}</h3> + {{- partial "PrepareHTML" .Params.results -}} + </section> {{- end -}} </div> </div> diff --git a/layouts/partials/programs/single.html b/layouts/partials/programs/single.html index 8826e8e0fd3d9a6f15e099453c1ef466b27cd5a9..52e6dce70d13339c62f2b968be6e2a83c1dedc69 100644 --- a/layouts/partials/programs/single.html +++ b/layouts/partials/programs/single.html @@ -24,8 +24,8 @@ <div class="container"> {{- partial "programs/abstract.html" .Params.presentation -}} </div> - {{- partial "programs/children.html" .Pages -}} {{- partial "programs/presentation.html" . -}} + {{- partial "programs/children.html" .Pages -}} {{- partial "programs/pedagogy.html" . -}} {{- partial "programs/results.html" . -}} {{- partial "programs/admission.html" . -}} diff --git a/layouts/partials/programs/toc.html b/layouts/partials/programs/toc.html index bd35c3d5ce2a3e779be537e34277b58985c46c57..8e858cfd1a932449d3ecfdf8d4d4879539ff9100 100644 --- a/layouts/partials/programs/toc.html +++ b/layouts/partials/programs/toc.html @@ -12,16 +12,19 @@ {{ $accessibility := partial "GetTextFromHTML" .context.Params.accessibility }} {{ $other := partial "GetTextFromHTML" .context.Params.other }} +{{ $roles := .context.Params.roles }} +{{ $contacts := partial "GetTextFromHTML" .context.Params.contacts }} + {{/* nav-link required for toggle active class */}} <nav class="toc" id="nav-toc" aria-label="{{ i18n "commons.toc" }}"> <ol> <li> - <a href="#{{ anchorize (i18n "programs.toc.essential") }}">{{ i18n "programs.toc.essential" }}</a> + <a href="#{{ urlize (i18n "programs.toc.essential") }}">{{ i18n "programs.toc.essential" }}</a> </li> <li> - <a href="#{{ anchorize (i18n "programs.toc.presentation") }}">{{ i18n "programs.toc.presentation" }}</a> + <a href="#{{ urlize (i18n "programs.toc.presentation") }}">{{ i18n "programs.toc.presentation" }}</a> <ol> - <li><a href="#{{ anchorize (i18n "programs.administrative_information") }}">{{ i18n "programs.administrative_information" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.administrative_information") }}">{{ i18n "programs.administrative_information" }}</a></li> {{- if .context.Params.blocks -}} {{- partial "blocks/toc" .context.Params.blocks -}} {{- end -}} @@ -32,16 +35,16 @@ {{- if or $content $pedagogy $evaluation $teachers }} <ol> {{- if $content -}} - <li><a href="#{{ anchorize (i18n "programs.content") }}">{{ i18n "programs.content" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.content") }}">{{ i18n "programs.content" }}</a></li> {{- end -}} {{- if $pedagogy -}} - <li><a href="#{{ anchorize (i18n "programs.pedagogy") }}">{{ i18n "programs.pedagogy" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.pedagogy") }}">{{ i18n "programs.pedagogy" }}</a></li> {{- end -}} {{- if $evaluation -}} - <li><a href="#{{ anchorize (i18n "programs.evaluation") }}">{{ i18n "programs.evaluation" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.evaluation") }}">{{ i18n "programs.evaluation" }}</a></li> {{- end -}} {{- if $teachers -}} - <li><a href="#{{ anchorize (i18n "programs.teachers") }}">{{ i18n "programs.evaluation" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.teachers") }}">{{ i18n "programs.teachers" }}</a></li> {{- end -}} </ol> {{ end -}} @@ -51,32 +54,38 @@ {{- if or $opportunities $results }} <ol> {{- if $opportunities -}} - <li><a href="#{{ anchorize (i18n "programs.opportunities") }}">{{ i18n "programs.opportunities" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.opportunities") }}">{{ i18n "programs.opportunities" }}</a></li> {{- end -}} {{- if $results -}} - <li><a href="#{{ anchorize (i18n "programs.results") }}">{{ i18n "programs.results" }}</a></li> + <li><a href="#{{ urlize (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 }} + {{- if or $prerequisites $pricing $registration $accessibility $other $roles $contacts }} <ol> {{- if $prerequisites -}} - <li><a href="#{{ anchorize (i18n "programs.prerequisites") }}">{{ i18n "programs.prerequisites" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.prerequisites") }}">{{ i18n "programs.prerequisites" }}</a></li> {{- end -}} {{- if $pricing -}} - <li><a href="#{{ anchorize (i18n "programs.pricing") }}">{{ i18n "programs.pricing" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.pricing") }}">{{ i18n "programs.pricing" }}</a></li> {{- end -}} {{- if $registration -}} - <li><a href="#{{ anchorize (i18n "programs.registration") }}">{{ i18n "programs.registration" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.registration") }}">{{ i18n "programs.registration" }}</a></li> {{- end -}} {{- if $accessibility -}} - <li><a href="#{{ anchorize (i18n "programs.accessibility") }}">{{ i18n "programs.accessibility" }}</a></li> + <li><a href="#{{ urlize (i18n "programs.accessibility") }}">{{ i18n "programs.accessibility" }}</a></li> {{- end -}} {{- if $other -}} - <li><a href="#{{ anchorize (i18n "programs._other") }}">{{ i18n "programs._other" }}</a></li> + <li><a href="#{{ urlize (i18n "programs._other") }}">{{ i18n "programs._other" }}</a></li> + {{- end -}} + {{- if $roles -}} + <li><a href="#{{ urlize (i18n "programs.roles") }}">{{ i18n "programs.roles" }}</a></li> + {{- end -}} + {{- if $contacts -}} + <li><a href="#{{ urlize (i18n "programs.contacts") }}">{{ i18n "programs.contacts" }}</a></li> {{- end -}} </ol> {{ end -}} diff --git a/layouts/partials/toc/container.html b/layouts/partials/toc/container.html index 10e9489e135d787201597ca624a9ed359f145c49..b0322680512b7e301480f46d7f0fe74c482dad70 100644 --- a/layouts/partials/toc/container.html +++ b/layouts/partials/toc/container.html @@ -3,7 +3,7 @@ {{- if $isTocNeeded -}} {{- partial "toc/cta" -}} - <div class="toc-container" aria-expanded="true" aria-labelledby="toc-title"> + <div class="toc-container" aria-hidden="false" aria-labelledby="toc-title"> <div class="toc-content"> {{/* TODO : quelle balise pour le titre du toc ? */}} <div id="toc-title" class="toc-title">{{ i18n "commons.toc" }}</div>