From 73a7c7aa8a525c9507507693d3e92b857a01ef21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexa=20Valentov=C3=A1?= <git@imaniti.org>
Date: Wed, 12 Mar 2025 10:16:11 +0100
Subject: [PATCH] main image, transp. header

---
 ...0122_uniwebhomepage_main_image_and_more.py | 25 +++++++++++++++++++
 uniweb/models.py                              | 23 +++++++++++++++++
 uniweb/templates/uniweb/uniweb_home_page.html |  2 +-
 3 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 uniweb/migrations/0122_uniwebhomepage_main_image_and_more.py

diff --git a/uniweb/migrations/0122_uniwebhomepage_main_image_and_more.py b/uniweb/migrations/0122_uniwebhomepage_main_image_and_more.py
new file mode 100644
index 00000000..8ea25ea3
--- /dev/null
+++ b/uniweb/migrations/0122_uniwebhomepage_main_image_and_more.py
@@ -0,0 +1,25 @@
+# Generated by Django 5.0.7 on 2025-03-12 09:11
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('uniweb', '0121_alter_uniwebarticlepage_content_and_more'),
+        ('wagtailimages', '0027_image_description'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='uniwebhomepage',
+            name='main_image',
+            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailimages.image', verbose_name='Obrázek na pozadí hlavičky'),
+        ),
+        migrations.AddField(
+            model_name='uniwebhomepage',
+            name='show_transparent_header',
+            field=models.BooleanField(default=False, help_text='Pokud je toto pole zaškrtlé, obrázek na pozadí hlavičky se neztmaví.', verbose_name='Průhledná hlavička?'),
+        ),
+    ]
diff --git a/uniweb/models.py b/uniweb/models.py
index 71219461..61102ef9 100644
--- a/uniweb/models.py
+++ b/uniweb/models.py
@@ -77,6 +77,24 @@ class UniwebHomePage(
 
     ### FIELDS
 
+    show_transparent_header = models.BooleanField(
+        default=False,
+        verbose_name="Průhledná hlavička?",
+        help_text=(
+            "Pokud je toto pole zaškrtlé, obrázek na pozadí hlavičky "
+            "se neztmavĂ­."
+        )
+    )
+
+    main_image = models.ForeignKey(
+        "wagtailimages.Image",
+        on_delete=models.PROTECT,
+        blank=True,
+        null=True,
+        verbose_name="Obrázek na pozadí hlavičky",
+        related_name="+",
+    )
+
     menu_button_name = models.CharField(
         verbose_name="Text na tlaÄŤĂ­tku pro zapojenĂ­", max_length=16
     )
@@ -138,6 +156,11 @@ class UniwebHomePage(
 
     ### PANELS
 
+    content_panels = MainHomePageMixin.content_panels + [
+        FieldPanel("main_image"),
+        FieldPanel("show_transparent_header"),
+    ]
+
     settings_panels = [
         MultiFieldPanel(
             [
diff --git a/uniweb/templates/uniweb/uniweb_home_page.html b/uniweb/templates/uniweb/uniweb_home_page.html
index 9b4b4ea0..e7412916 100644
--- a/uniweb/templates/uniweb/uniweb_home_page.html
+++ b/uniweb/templates/uniweb/uniweb_home_page.html
@@ -8,7 +8,7 @@
   {% endblock %}
 
   {% block header %}
-    {% include 'styleguide2/includes/organisms/header/photo_header.html' with title=page.title main_image=page.main_image show_scroll_progress=page.show_scroll_progress %}
+    {% include 'styleguide2/includes/organisms/header/photo_header.html' with show_transparent_header=page.show_transparent_header title=page.title main_image=page.main_image show_scroll_progress=page.show_scroll_progress %}
   {% endblock %}
 
   <main class="mb-2 lg:mb-12">
-- 
GitLab