diff --git a/district/migrations/0073_districtgeofeaturecollectionpage_logo_image_and_more.py b/district/migrations/0073_districtgeofeaturecollectionpage_logo_image_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..3c0df265185568d11dc97fdfdcaa62f208c30238 --- /dev/null +++ b/district/migrations/0073_districtgeofeaturecollectionpage_logo_image_and_more.py @@ -0,0 +1,39 @@ +# Generated by Django 4.0.4 on 2022-05-20 14:34 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailimages", "0023_add_choose_permissions"), + ("district", "0072_alter_districtprogrampage_content"), + ] + + operations = [ + migrations.AddField( + model_name="districtgeofeaturecollectionpage", + name="logo_image", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="wagtailimages.image", + verbose_name="Logo", + ), + ), + migrations.AlterField( + model_name="districtgeofeaturecollectionpage", + name="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í", + ), + ), + ] diff --git a/district/models.py b/district/models.py index 8beb27b9af2ccc923f5347862cc58b1fbfa7c927..dbe93f2afedd218e4083233315b447aba4d94f49 100644 --- a/district/models.py +++ b/district/models.py @@ -1312,7 +1312,16 @@ class DistrictGeoFeatureCollectionPage( on_delete=models.PROTECT, blank=True, null=True, - verbose_name="obrázek", + verbose_name="Obrázek na pozadí", + related_name="+", + ) + logo_image = models.ForeignKey( + "wagtailimages.Image", + on_delete=models.PROTECT, + blank=True, + null=True, + verbose_name="Logo", + related_name="+", ) style = models.CharField( "Styl mapy", choices=MAP_STYLES, max_length=50, default=DEFAULT_MAP_STYLE @@ -1329,6 +1338,7 @@ class DistrictGeoFeatureCollectionPage( [ FieldPanel("perex"), StreamFieldPanel("content"), + ImageChooserPanel("logo_image"), ImageChooserPanel("image"), ], "Obsah hlavní stránky kolekce", diff --git a/district/templates/district/district_geo_feature_collection_page.html b/district/templates/district/district_geo_feature_collection_page.html index abc3513a709a1297b4e53d5b1f1abfad4d3f2c96..ba9f8dd06d69e1cc2245cc5b00eaec5be02c74d8 100644 --- a/district/templates/district/district_geo_feature_collection_page.html +++ b/district/templates/district/district_geo_feature_collection_page.html @@ -1,28 +1,32 @@ {% extends "district/base.html" %} {% load static wagtailcore_tags wagtailimages_tags %} - {% block subheader %} - {% image page.image width-1920 as bg_img %} - <header class="hero hero--image pt-16 pb-24 lg:pt-32 pb-24" style="--image-url: url({{ bg_img.full_url }})"> - <div class="container container--default text-center lg:text-left"> - {% comment %} Page index for screens up to md {% endcomment %} - {% if page.index %} - <div class="text-center relative mb-4 lg:hidden"> - <span class="rounded-full inline-flex items-center justify-center bg-grey-125 font-bold text-center text-4xl md:text-5xl w-20 h-20 md:w-24 md:h-24 border-white border-8 text-black">{{ page.index }}</span> - </div> - {% endif %} - - <h1 class="head-alt-lg md:head-alt-xl text-shadow-lg max-w-2xl mx-auto lg:mx-0"> - {{ page.title }} - </h1> + {% if page.image %} + {% image page.image width-1920 as bg_img %} + {% else %} + {% image page.root_page.fallback_image width-1920 as bg_img %} + {% endif %} - <h2 class="head-xs text-shadow-lg max-w-xl mb-2 mx-auto lg:mx-0"> - {{ page.perex }} - </h2> + <header class="hero hero--image text-center md:text-left py-16" style="--image-url: url({{ bg_img.full_url }})"> + <div class="container container--default grid lg:grid-cols-7 gap-4 items-center text-center lg:text-left"> + <div class="lg:col-span-3 order-2 lg:order-1"> + <h1 class="head-alt-lg md:head-alt-xl text-shadow-lg max-w-2xl mx-auto lg:mx-0"> + {{ page.title }} + </h1> + <h2 class="head-xs text-shadow-lg max-w-xl mb-2 mx-auto lg:mx-0"> + {{ page.perex }} + </h2> + </div> + <div class="lg:col-span-4 order-1 lg:order-2"> + {% if page.logo_image %} + {% image page.logo_image width-490 as logo_img %} + <img src="{{ logo_img.url }}" class="h-32 lg:h-80 m-auto object-contain" alt="{{ page.title }}"> + {% endif %} + </div> </div> </header> -{% endblock %} +{% endblock subheader %} {% block container_class %}container--default{% endblock %} {% block container_spacing %}py-8 pb-0 lg:py-16{% endblock %}