From f18ab61067c07067b01ad55e21e0726feb2ff26f Mon Sep 17 00:00:00 2001
From: Olivia206 <olivia.simonet@mmibordeaux.com>
Date: Fri, 16 Feb 2024 12:49:12 +0100
Subject: [PATCH] added layouts to locations

---
 assets/sass/_theme/hugo-osuny.sass           |  1 +
 assets/sass/_theme/sections/locations.sass   | 22 +++++++++++++
 config.yaml                                  | 17 +++++++++-
 layouts/locations/list.html                  | 19 +++++++++++
 layouts/locations/term.html                  | 19 +++++++++++
 layouts/partials/locations/hero-list.html    |  8 +++++
 layouts/partials/locations/hero-single.html  | 13 ++++++++
 layouts/partials/locations/location.html     | 34 ++++++++++++++++++++
 layouts/partials/locations/locations.html    |  6 ++++
 layouts/partials/locations/sidebar.html      | 14 ++++++++
 layouts/partials/locations/summary copy.html |  1 +
 layouts/partials/locations/summary.html      |  1 +
 12 files changed, 154 insertions(+), 1 deletion(-)
 create mode 100644 assets/sass/_theme/sections/locations.sass
 create mode 100644 layouts/locations/list.html
 create mode 100644 layouts/locations/term.html
 create mode 100644 layouts/partials/locations/hero-list.html
 create mode 100644 layouts/partials/locations/hero-single.html
 create mode 100644 layouts/partials/locations/location.html
 create mode 100644 layouts/partials/locations/locations.html
 create mode 100644 layouts/partials/locations/sidebar.html
 create mode 100644 layouts/partials/locations/summary copy.html
 create mode 100644 layouts/partials/locations/summary.html

diff --git a/assets/sass/_theme/hugo-osuny.sass b/assets/sass/_theme/hugo-osuny.sass
index 216dc1a3..e998ad16 100644
--- a/assets/sass/_theme/hugo-osuny.sass
+++ b/assets/sass/_theme/hugo-osuny.sass
@@ -67,6 +67,7 @@
 @import "sections/categories"
 @import "sections/diplomas"
 @import "sections/events"
+@import "sections/locations"
 @import "sections/organizations"
 @import "sections/pages"
 @import "sections/papers"
diff --git a/assets/sass/_theme/sections/locations.sass b/assets/sass/_theme/sections/locations.sass
new file mode 100644
index 00000000..8cd29ad8
--- /dev/null
+++ b/assets/sass/_theme/sections/locations.sass
@@ -0,0 +1,22 @@
+.locations__taxonomy
+    .locations
+        .location
+            @include media-breakpoint-up(desktop)
+                .media
+                    width: col(4)
+                &-content
+                    width: col(6)
+
+.location
+    display: flex
+    gap: $grid-gutter
+    .media
+        order: -1
+    &-title
+        @include icon(arrow-right, after)
+    @include media-breakpoint-down(desktop)
+        flex-direction: column
+        .media
+            // TODO : REMOVE HALF
+            margin-left: half(-$grid-gutter)
+            margin-right: half(-$grid-gutter)
\ No newline at end of file
diff --git a/config.yaml b/config.yaml
index fa8733f4..319c75be 100644
--- a/config.yaml
+++ b/config.yaml
@@ -52,6 +52,8 @@ params:
       direction: start
   volumes:
     default_image: false
+  locations:
+    default_image: false
   persons:
     index:
       layout: grid # grid | list
@@ -271,4 +273,17 @@ params:
         item:
           mobile:   327x388
           tablet:   208x247
-          desktop:  300x356
\ No newline at end of file
+          desktop:  300x356
+      locations:
+        hero:
+          mobile:   400
+          tablet:   800
+          desktop:  900
+        hero_single:
+          mobile:   400
+          tablet:   800
+          desktop:  900
+        item:
+          mobile:   350
+          tablet:   450
+          desktop:  900
\ No newline at end of file
diff --git a/layouts/locations/list.html b/layouts/locations/list.html
new file mode 100644
index 00000000..68d9923f
--- /dev/null
+++ b/layouts/locations/list.html
@@ -0,0 +1,19 @@
+{{ define "main" }}
+  {{ partial "locations/hero-list.html" . }}
+
+  <div class="document-content">
+    {{ partial "commons/list-content.html" . }}
+  
+    {{ partial "locations/summary.html" (dict
+        "with_container" true
+        "context" .
+      ) }}
+  
+    {{ partial "contents/list.html" . }}
+  
+    <div class="container">
+      {{ partial "locations/locations.html" . }}
+    </div>
+  </div>
+
+{{ end }}
diff --git a/layouts/locations/term.html b/layouts/locations/term.html
new file mode 100644
index 00000000..5f5e7743
--- /dev/null
+++ b/layouts/locations/term.html
@@ -0,0 +1,19 @@
+{{ define "main" }}
+  {{ partial "locations/hero-single.html" . }}
+
+  <div class="document-content" itemscope itemtype="https://schema.org/EducationalOrganization">
+    <meta itemprop="name" content="{{ partial "PrepareHTML" .Title }}">
+    <meta itemprop="url" content="{{ .Permalink }}">
+    {{ with .Params.summary }}<meta itemprop="abstract" content="{{ . | safeHTML }}">{{ end }}
+    {{ with .Summary }}<meta itemprop="description" content="{{ . | safeHTML }}">{{ end }}
+
+    {{ partial "locations/summary.html" (dict
+        "context" .
+        "block_wrapped" true
+      ) }}
+
+    {{ partial "contents/list.html" . }}
+
+    {{ partial "hooks/before-document-content-end.html" . }}
+  </div>
+{{ end }}
diff --git a/layouts/partials/locations/hero-list.html b/layouts/partials/locations/hero-list.html
new file mode 100644
index 00000000..b356483e
--- /dev/null
+++ b/layouts/partials/locations/hero-list.html
@@ -0,0 +1,8 @@
+{{- $title := or .Params.header_text .Title -}}
+{{- partial "header/hero.html"
+      (dict
+        "title" $title
+        "image" .Params.image
+        "sizes" site.Params.image_sizes.sections.events.hero
+        "context" .
+      ) -}}
diff --git a/layouts/partials/locations/hero-single.html b/layouts/partials/locations/hero-single.html
new file mode 100644
index 00000000..d13a6df8
--- /dev/null
+++ b/layouts/partials/locations/hero-single.html
@@ -0,0 +1,13 @@
+{{- $title := or .Params.header_text .Title -}}
+
+{{ with .Params.subtitle }}
+  {{- $title = printf "%s <span>%s</span>" $title . -}}
+{{ end }}
+
+{{- partial "header/hero.html"
+  (dict
+    "title" $title
+    "image" .Params.image
+    "sizes" site.Params.image_sizes.sections.events.hero_single
+    "context" .
+  ) -}}
diff --git a/layouts/partials/locations/location.html b/layouts/partials/locations/location.html
new file mode 100644
index 00000000..23ffb50b
--- /dev/null
+++ b/layouts/partials/locations/location.html
@@ -0,0 +1,34 @@
+{{ $location := . }}
+
+{{ with $location }}
+  <article class="location" itemscope itemtype="https://schema.org/EducationalOrganization">
+    <div class="location-content">
+      {{- $title := partial "PrepareHTML" .Title -}}
+      <h2 class="location-title">
+        <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a>
+      </h2>
+  
+      {{- if (partial "GetTextFromHTML" .Params.summary) -}}
+        <div class="location-description">
+          <p itemprop="description">
+            {{ partial "GetTruncateContent" ( dict 
+              "text" .Params.summary
+              "length" site.Params.locations.index.truncate_description
+              ) }}
+          </p>
+        </div>
+      {{- end -}}
+    </div>
+    <div class="media">
+      {{- if .Params.image -}}
+        {{- partial "commons/image.html"
+            (dict
+              "image"    .Params.image
+              "sizes"    site.Params.image_sizes.sections.locations.item
+            ) -}}
+      {{- else -}}
+        {{- partial "commons/image-default.html" "locations" -}}
+      {{- end -}}
+    </div>
+  </article>
+{{ end }}
\ No newline at end of file
diff --git a/layouts/partials/locations/locations.html b/layouts/partials/locations/locations.html
new file mode 100644
index 00000000..1ad976ad
--- /dev/null
+++ b/layouts/partials/locations/locations.html
@@ -0,0 +1,6 @@
+
+<div class="locations">
+  {{ range .Paginator.Pages }}
+    {{ partial "locations/location.html" . }}
+  {{ end }}
+</div>
diff --git a/layouts/partials/locations/sidebar.html b/layouts/partials/locations/sidebar.html
new file mode 100644
index 00000000..e491bc70
--- /dev/null
+++ b/layouts/partials/locations/sidebar.html
@@ -0,0 +1,14 @@
+<div class="section-sidebar event-sidebar">
+  <div>
+    <aside>
+      {{- partial "events/event-infos.html" . -}}
+    </aside>
+
+    {{ partial "toc/container.html"
+      (dict
+          "toc" "toc/default.html"
+          "context" .
+      )
+    }}
+  </div>
+</div>
diff --git a/layouts/partials/locations/summary copy.html b/layouts/partials/locations/summary copy.html
new file mode 100644
index 00000000..85e4edf8
--- /dev/null
+++ b/layouts/partials/locations/summary copy.html	
@@ -0,0 +1 @@
+{{- partial "commons/summary-in-content.html" . -}}
diff --git a/layouts/partials/locations/summary.html b/layouts/partials/locations/summary.html
new file mode 100644
index 00000000..089279d8
--- /dev/null
+++ b/layouts/partials/locations/summary.html
@@ -0,0 +1 @@
+{{- partial "commons/summary-in-content.html" . -}}
\ No newline at end of file
-- 
GitLab