From 3949a32afbf49bcdb543d990eb083c3728b03926 Mon Sep 17 00:00:00 2001
From: alexisben <alex@noesya.coop>
Date: Wed, 14 Dec 2022 14:31:05 +0100
Subject: [PATCH] fix diplomas hero

---
 layouts/diplomas/list.html                 |  3 ---
 layouts/partials/diplomas/diplomas.html    | 26 +++++++++-------------
 layouts/partials/diplomas/hero-list.html   |  1 +
 layouts/partials/diplomas/hero-single.html | 16 +++++++++++++
 4 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/layouts/diplomas/list.html b/layouts/diplomas/list.html
index 10585d3e..90957484 100644
--- a/layouts/diplomas/list.html
+++ b/layouts/diplomas/list.html
@@ -3,14 +3,11 @@
 
   <div class="document-content">
     <div class="container">
-      {{ partial "diplomas/image.html" .Params.image }}
       {{ partial "diplomas/chapo.html" .Params.description_short }}
     </div>
     {{ partial "blocks/list.html" . }}
     <div class="container">
-      {{ .Scratch.Set "show_programs" true }}
       {{ partial "diplomas/diplomas.html" . }}
-      {{ .Scratch.Delete "show_programs" }}
     </div>
   </div>
 
diff --git a/layouts/partials/diplomas/diplomas.html b/layouts/partials/diplomas/diplomas.html
index f7a297eb..cf025d6b 100644
--- a/layouts/partials/diplomas/diplomas.html
+++ b/layouts/partials/diplomas/diplomas.html
@@ -1,7 +1,3 @@
-{{ $show_programs := false }}
-{{- if .Scratch.Get "show_programs" }}
-  {{ $show_programs = true }}
-{{ end -}}
 <ul class="diplomas">
   {{ range .Paginator.Pages }}
     <li>
@@ -18,17 +14,17 @@
           Lorem, ipsum dolor sit amet consectetur adipisicing elit. Esse labore aliquid nobis quasi, molestiae voluptatum ullam et consequatur voluptas. Eligendi quaerat veniam, sequi repellat illo dignissimos quasi libero itaque dolorum?
           {{- partial "PrepareHTML" .Params.description_short -}}
         </div>
-        {{- if $show_programs }}
-          <ol class="programs">
-            {{- range .Pages -}}
-              <li>
-                <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" .Title)) }}">
-                  {{- partial "PrepareHTML" .Title -}}
-                </a>
-              </li>
-            {{- end -}}
-          </ol>
-        {{ end -}}
+
+        <ol class="programs">
+          {{- range .Pages -}}
+            <li>
+              <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" .Title)) }}">
+                {{- partial "PrepareHTML" .Title -}}
+              </a>
+            </li>
+          {{- end -}}
+        </ol>
+
       </div>
     </li>
   {{ end }}
diff --git a/layouts/partials/diplomas/hero-list.html b/layouts/partials/diplomas/hero-list.html
index d989fe21..8e7e675c 100644
--- a/layouts/partials/diplomas/hero-list.html
+++ b/layouts/partials/diplomas/hero-list.html
@@ -2,5 +2,6 @@
 {{- partial "header/hero.html"
       (dict
         "title" $title
+        "image" .Params.image
         "context" .
       ) -}}
diff --git a/layouts/partials/diplomas/hero-single.html b/layouts/partials/diplomas/hero-single.html
index 0d4312a1..abe6f4f9 100644
--- a/layouts/partials/diplomas/hero-single.html
+++ b/layouts/partials/diplomas/hero-single.html
@@ -6,6 +6,22 @@
     {{- end -}}
     <div class="content">
       <h1>{{ partial "PrepareHTML" $title }}</h1>
+      {{- if .Params.image }}
+        <figure>
+          {{ partial "commons/image.html"
+            (dict
+              "image"    .image
+              "mobile"   "351"
+              "tablet"   "456"
+              "desktop"  "856"
+            ) }}
+          {{ if .image.credit }}
+            <figcaption>
+              {{- partial "PrepareHTML" .image.credit -}}
+            </figcaption>
+          {{ end }}
+        </figure>
+      {{ end -}}
     </div>
   </div>
   <div id="essential">
-- 
GitLab