From a747afce40e9b30344908e84382d3dc5d3a9d264 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org>
Date: Thu, 21 Dec 2023 12:24:17 +0100
Subject: [PATCH] fix newsletter subscribing

---
 main/templates/main/base.html                          |  1 +
 .../main/includes/atoms/buttons/round_button.html      |  6 +++---
 .../main/includes/atoms/buttons/round_button_form.html |  6 ++++++
 .../includes/molecules/contact/contact_footer_box.html |  4 +++-
 .../main/includes/organisms/layout/messages.html       | 10 +++++++---
 .../organisms/main_section/newsletter_section.html     |  4 ++--
 6 files changed, 22 insertions(+), 9 deletions(-)
 create mode 100644 main/templates/main/includes/atoms/buttons/round_button_form.html

diff --git a/main/templates/main/base.html b/main/templates/main/base.html
index 077b6903..64c7cdc4 100644
--- a/main/templates/main/base.html
+++ b/main/templates/main/base.html
@@ -1,4 +1,5 @@
 {% load static wagtailcore_tags wagtailimages_tags wagtailmetadata_tags %}
+
 <!doctype html>
 <html lang="cs">
   <head>
diff --git a/main/templates/main/includes/atoms/buttons/round_button.html b/main/templates/main/includes/atoms/buttons/round_button.html
index 1803fb28..3e978f06 100644
--- a/main/templates/main/includes/atoms/buttons/round_button.html
+++ b/main/templates/main/includes/atoms/buttons/round_button.html
@@ -1,5 +1,5 @@
-<a
-  href="{% if url %}{{ url }}{% else %}{% endif %}"
+<{% block element_opener %}a{% endblock %}
+  {% block href %}href="{% if url %}{{ url }}{% else %}{% endif %}"{% endblock %}
   class="
     flex items-center group rounded-full font-condensed uppercase font-semibold tracking-normal
     hover:no-underline
@@ -19,4 +19,4 @@
 >
   <span class="group-hover:-translate-x-2 duration-200">{{ button_text }}</span>
   <span class="opacity-0 group-hover:opacity-100 duration-200">{% include 'main/includes/atoms/icons/arrow.html' %}</span>
-</a>
+</{% block element_closer %}a{% endblock %}>
diff --git a/main/templates/main/includes/atoms/buttons/round_button_form.html b/main/templates/main/includes/atoms/buttons/round_button_form.html
new file mode 100644
index 00000000..b53507bc
--- /dev/null
+++ b/main/templates/main/includes/atoms/buttons/round_button_form.html
@@ -0,0 +1,6 @@
+{% extends 'main/includes/atoms/buttons/round_button.html' %}
+
+{% block element_opener %}button{% endblock %}
+{% block element_closer %}button{% endblock %}
+
+{% block href %}{% endblock %}
diff --git a/main/templates/main/includes/molecules/contact/contact_footer_box.html b/main/templates/main/includes/molecules/contact/contact_footer_box.html
index b19a0b56..55a06795 100644
--- a/main/templates/main/includes/molecules/contact/contact_footer_box.html
+++ b/main/templates/main/includes/molecules/contact/contact_footer_box.html
@@ -1,9 +1,11 @@
+{% load static %}
+
 <div class="flex grow flex-col gap-0 md:flex-row md:gap-8">
   <div class="md:shrink-0">
     <a href="{{ url }}">
       <img
         class="h-36 w-36 object-cover rounded-full"
-        src="{{ image.url }}"
+        src="{% if image %}{{ image.url }}{% else %}{% static 'shared/img/unknown_pirate_160x160.jpg' %}{% endif %}"
         alt="{{ name }}"
       >
     </a>
diff --git a/main/templates/main/includes/organisms/layout/messages.html b/main/templates/main/includes/organisms/layout/messages.html
index 35653d9f..496ac48d 100644
--- a/main/templates/main/includes/organisms/layout/messages.html
+++ b/main/templates/main/includes/organisms/layout/messages.html
@@ -1,7 +1,11 @@
 <ul class="flex flex-col w-full">
     {% for message in messages %}
-        <li>
-            {% include "main/includes/molecules/blocks/message_block.html" with type=message.type content=message.content is_last_child=forloop.last %}
-        </li>
+        <script>alert("{{ message }}");</script>
+
+        {% comment %}
+            <li>
+                {% include "main/includes/molecules/blocks/message_block.html" with type=message.type content=message.content is_last_child=forloop.last %}
+            </li>
+        {% endcomment %}
     {% endfor %}
 </ul>
diff --git a/main/templates/main/includes/organisms/main_section/newsletter_section.html b/main/templates/main/includes/organisms/main_section/newsletter_section.html
index 334f6482..d128d90b 100644
--- a/main/templates/main/includes/organisms/main_section/newsletter_section.html
+++ b/main/templates/main/includes/organisms/main_section/newsletter_section.html
@@ -24,14 +24,14 @@
 
       {% include 'main/includes/atoms/form_fields/form_input.html' with name="email" placeholder='Tvůj email' classes='mb-3 w-full md:w-96' %}
 
-      <div class="checkbox form-field__control flex items-center mb-3">
+      <div class="checkbox flex items-center mb-3">
         <input type="checkbox" id="confirmed" name="confirmed" required>
         <label for="confirmed">
           Souhlasím se <a href="{{ page.root_page.gdpr_and_cookies_url }}" target="_blank">zpracováním osobních údajů</a>
         </label>
       </div>
 
-      {% include 'main/includes/atoms/buttons/round_button.html' with button_text='Odebírat' %}
+      {% include 'main/includes/atoms/buttons/round_button_form.html' with button_text='Odebírat' %}
     </form>
   </div>
 </div>
-- 
GitLab