From 66e94a2e41d2540d45f0f9aac5a6899046a72484 Mon Sep 17 00:00:00 2001
From: Ondrej Rehounek <ondra.rehounek@seznam.cz>
Date: Fri, 19 Nov 2021 16:26:40 +0100
Subject: [PATCH] district: Refactor some snippets to shared

---
 .../district/blocks/candidate_list_block.html    |  6 +++---
 .../district/blocks/homepage_calendar_block.html | 16 ++++++++++++++++
 .../templates/district/district_center_page.html |  2 +-
 .../district/district_election_page.html         |  2 +-
 .../shared}/compact_candidate_snippet.html       |  0
 .../shared}/election_point_card_snippet.html     |  0
 .../shared}/full_candidate_snippet.html          |  0
 .../shared}/small_calendar_snippet.html          |  0
 8 files changed, 21 insertions(+), 5 deletions(-)
 create mode 100644 district/templates/district/blocks/homepage_calendar_block.html
 rename {district/templates/district/include => shared/templates/shared}/compact_candidate_snippet.html (100%)
 rename {district/templates/district/include => shared/templates/shared}/election_point_card_snippet.html (100%)
 rename {district/templates/district/include => shared/templates/shared}/full_candidate_snippet.html (100%)
 rename {district/templates/district/include => shared/templates/shared}/small_calendar_snippet.html (100%)

diff --git a/district/templates/district/blocks/candidate_list_block.html b/district/templates/district/blocks/candidate_list_block.html
index fd0cd6882..8b08652d6 100644
--- a/district/templates/district/blocks/candidate_list_block.html
+++ b/district/templates/district/blocks/candidate_list_block.html
@@ -5,7 +5,7 @@
 <div class="candidate-card-list grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
   {% for person_page in self.candidate_list %}
     {% if forloop.counter < 8 %}
-      {% include "district/include/full_candidate_snippet.html" %}
+      {% include "shared/full_candidate_snippet.html" %}
     {% endif %}
   {% endfor %}
   <aside class="banner bg-black text-white container-padding--zero sm:container-padding--auto">
@@ -31,14 +31,14 @@
       {% for person_page in self.candidate_list %}
         {# Záměrně neomezuju list přes indexy, abych si držel counter pro snippet #}
         {% if forloop.counter >= 8 and forloop.counter < 16  %}
-          {% include "district/include/compact_candidate_snippet.html" %}
+          {% include "shared/compact_candidate_snippet.html" %}
         {% endif %}
       {% endfor %}
       <template v-if="isCurrentView('fullCandidateTable')">
         {% for person_page in self.candidate_list %}
           {# Záměrně neomezuju list přes indexy, abych si držel counter pro snippet #}
           {% if forloop.counter >= 16  %}
-            {% include "district/include/compact_candidate_snippet.html" %}
+            {% include "shared/compact_candidate_snippet.html" %}
           {% endif %}
         {% endfor %}
       </template>
diff --git a/district/templates/district/blocks/homepage_calendar_block.html b/district/templates/district/blocks/homepage_calendar_block.html
new file mode 100644
index 000000000..c6aed45f3
--- /dev/null
+++ b/district/templates/district/blocks/homepage_calendar_block.html
@@ -0,0 +1,16 @@
+{% load wagtailimages_tags %}
+
+{% image self.image width-1920 as img %}
+<header
+  class="hero hero--image py-16 "
+  style="--image-url: url({{ img.url }})"
+>
+  <div class="container container--default">
+    <h1 class="head-alt-md md:head-alt-lg max-w-2xl ">
+      {{ self.title }}
+    </h1>
+    <h2 class="head-xs mt-2 ">
+      {{ self.subtitle }}
+    </h2>
+  </div>
+</header>
diff --git a/district/templates/district/district_center_page.html b/district/templates/district/district_center_page.html
index ca9969ec7..788a4f676 100644
--- a/district/templates/district/district_center_page.html
+++ b/district/templates/district/district_center_page.html
@@ -23,7 +23,7 @@
           <div class="content-block">
             {{ page.text | richtext }}
           </div>
-          {% include "district/include/small_calendar_snippet.html" %}
+          {% include "shared/small_calendar_snippet.html" %}
         </div>
         <div class="pt-8 lg:w-2/5 xl:w-1/3 lg:pt-0">
           <div class="lg:card lg:elevation-10">
diff --git a/district/templates/district/district_election_page.html b/district/templates/district/district_election_page.html
index 931ad90de..d81cf3a2d 100644
--- a/district/templates/district/district_election_page.html
+++ b/district/templates/district/district_election_page.html
@@ -46,7 +46,7 @@
 
             <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
               {% for election_point_page in election_points %}
-                {% include "district/include/election_point_card_snippet.html" %}
+                {% include "shared/election_point_card_snippet.html" %}
               {% endfor %}
             </div>
           </template>
diff --git a/district/templates/district/include/compact_candidate_snippet.html b/shared/templates/shared/compact_candidate_snippet.html
similarity index 100%
rename from district/templates/district/include/compact_candidate_snippet.html
rename to shared/templates/shared/compact_candidate_snippet.html
diff --git a/district/templates/district/include/election_point_card_snippet.html b/shared/templates/shared/election_point_card_snippet.html
similarity index 100%
rename from district/templates/district/include/election_point_card_snippet.html
rename to shared/templates/shared/election_point_card_snippet.html
diff --git a/district/templates/district/include/full_candidate_snippet.html b/shared/templates/shared/full_candidate_snippet.html
similarity index 100%
rename from district/templates/district/include/full_candidate_snippet.html
rename to shared/templates/shared/full_candidate_snippet.html
diff --git a/district/templates/district/include/small_calendar_snippet.html b/shared/templates/shared/small_calendar_snippet.html
similarity index 100%
rename from district/templates/district/include/small_calendar_snippet.html
rename to shared/templates/shared/small_calendar_snippet.html
-- 
GitLab