From 8c03b7f2690d878fc13bf2072ec1b7c16827898e Mon Sep 17 00:00:00 2001
From: Olivia206 <olivia.simonet@mmibordeaux.com>
Date: Mon, 6 Nov 2023 18:18:44 +0100
Subject: [PATCH] added conditions to agenda block

---
 layouts/partials/blocks/templates/agenda.html | 8 ++++++++
 layouts/partials/events/event.html            | 7 +++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/layouts/partials/blocks/templates/agenda.html b/layouts/partials/blocks/templates/agenda.html
index b84f2f46..0636100f 100644
--- a/layouts/partials/blocks/templates/agenda.html
+++ b/layouts/partials/blocks/templates/agenda.html
@@ -2,6 +2,11 @@
 {{- $position := .block.position -}}
 {{- $title := .block.title -}}
 {{- with .block.data -}}
+
+  {{- $show_summary := .show_summary -}}
+  {{- $show_category := .show_category -}}
+  {{- $show_status := .show_status -}}
+
   {{- $layout := .layout | default "list" -}}
   <div class="block block-agenda{{ if $title }} block-with-title{{ end }} block-agenda--{{- $layout }}">
     <div class="container">
@@ -26,6 +31,9 @@
                 {{ partial "events/event" (dict
                   "event" .
                   "layout" $layout
+                  "show_summary" $show_summary
+                  "show_category" $show_category
+                  "show_status" $show_status
                 ) }}
             {{ end }}
           {{ end }}
diff --git a/layouts/partials/events/event.html b/layouts/partials/events/event.html
index 4ca5272c..3e08067c 100644
--- a/layouts/partials/events/event.html
+++ b/layouts/partials/events/event.html
@@ -7,6 +7,9 @@
     ) }}
 {{ $index := .index }}
 {{ $alternate := .alternate }}
+{{ $show_summary := .show_summary }}
+{{ $show_category := .show_category }}
+{{ $show_status := .show_status }}
 
 {{ with $event }}
   <article class="event {{ if .Params.image }}event--with-image{{ end -}}" itemscope itemtype="https://schema.org/Event">
@@ -39,7 +42,7 @@
         </div>
       {{ end }}
 
-      {{ if and (site.Params.events.index.show_description) }}
+      {{ if and (site.Params.events.index.show_description) ($show_summary) }}
         {{- if (partial "GetTextFromHTML" .Params.summary) -}}
           <div class="event-description">
             <p itemprop="description">
@@ -55,7 +58,7 @@
           </div>
         {{- end -}}
   
-        {{ if .Params.categories }}
+        {{ if and (.Params.categories) ($show_category) }}
           <p class="event-categories">
             {{- range $index, $category := .GetTerms "categories" -}}
               <span>{{- $category.Title -}}</span>
-- 
GitLab