From: Radek Czajka Date: Fri, 8 May 2026 13:16:33 +0000 (+0200) Subject: Seasonal overlays X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d00a4bcb2ee6a3ec0c65600b854a86524dfa4d4b?ds=sidebyside;hp=8b021af276a2eb583fe962098b28459764f84b88 Seasonal overlays --- diff --git a/src/annoy/migrations/0023_banner_video_alter_banner_place.py b/src/annoy/migrations/0023_banner_video_alter_banner_place.py new file mode 100644 index 000000000..7ba8961eb --- /dev/null +++ b/src/annoy/migrations/0023_banner_video_alter_banner_place.py @@ -0,0 +1,23 @@ +# Generated by Django 4.0.8 on 2026-04-29 11:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('annoy', '0022_remove_banner_progress_remove_banner_target'), + ] + + operations = [ + migrations.AddField( + model_name='banner', + name='video', + field=models.FileField(blank=True, upload_to='annoy/banners/', verbose_name='video'), + ), + migrations.AlterField( + model_name='banner', + name='place', + field=models.SlugField(choices=[('top', 'U góry wszystkich stron'), ('book-page', 'Strona książki'), ('book-page-center', 'Strona książki, środek'), ('book-text-intermission', 'Przerwa w treści książki'), ('book-fragment-list', 'Obok listy fragmentów książki'), ('blackout', 'Blackout'), ('crisis', 'Kryzysowa'), ('seasonal', 'Sezonowa'), ('seasonal-overlay', 'Sezonowa-overlay')], verbose_name='miejsce'), + ), + ] diff --git a/src/annoy/models.py b/src/annoy/models.py index 7ef119ec2..c4f4ff0b3 100644 --- a/src/annoy/models.py +++ b/src/annoy/models.py @@ -87,6 +87,7 @@ class Banner(models.Model): close_label = models.CharField('etykieta zamykania', max_length=255, blank=True) text = models.TextField('tekst') image = models.FileField('obraz', upload_to='annoy/banners/', blank=True) + video = models.FileField('video', upload_to='annoy/banners/', blank=True) url = models.CharField('URL', max_length=1024) priority = models.PositiveSmallIntegerField( 'priorytet', default=0, diff --git a/src/annoy/places.py b/src/annoy/places.py index 2fbd34ca3..ae7fe4479 100644 --- a/src/annoy/places.py +++ b/src/annoy/places.py @@ -14,6 +14,7 @@ PLACE_DEFINITIONS = [ ('loud', 'Ostry'), )), ('seasonal', 'Sezonowa', False), + ('seasonal-overlay', 'Sezonowa-overlay', True), ] PLACE_CHOICES = [p[:2] for p in PLACE_DEFINITIONS] diff --git a/src/annoy/templates/annoy/banner_seasonal_overlay.html b/src/annoy/templates/annoy/banner_seasonal_overlay.html new file mode 100644 index 000000000..7ab86b2ff --- /dev/null +++ b/src/annoy/templates/annoy/banner_seasonal_overlay.html @@ -0,0 +1,41 @@ +{% if banner %} + +
+
+
+ + {% if banner.get_image %} +
+ +
+ {% endif %} + {% if banner.video %} + + {% endif %} +
+ {{ banner.get_text|safe }} + {{ banner.action_label }} +
+ + + + + + +
+ +
+
+{% endif %} diff --git a/src/annoy/templates/annoy/checkout_header.html b/src/annoy/templates/annoy/checkout_header.html new file mode 100644 index 000000000..225d3b509 --- /dev/null +++ b/src/annoy/templates/annoy/checkout_header.html @@ -0,0 +1,9 @@ + +
+ {% if banner.video %} + + {% endif %} +
+
+ {{ banner.text|safe }} +
diff --git a/src/annoy/templatetags/annoy.py b/src/annoy/templatetags/annoy.py index 602fb3cef..ac1b6283d 100644 --- a/src/annoy/templatetags/annoy.py +++ b/src/annoy/templatetags/annoy.py @@ -53,3 +53,23 @@ def annoy_banner_seasonal(context): 'banner': banners.first(), 'closable': False, } + +@register.inclusion_tag('annoy/banner_seasonal_overlay.html', takes_context=True) +def annoy_banner_seasonal_overlay(context): + banners = Banner.choice('seasonal-overlay', request=context['request']) + return { + 'banner': banners.first(), + } + + +@register.simple_tag(takes_context=True) +def seasonal_overlay_exists(context): + return Banner.choice('seasonal-overlay', request=context['request'], exemptions=False).exists() + + +@register.inclusion_tag('annoy/checkout_header.html', takes_context=True) +def annoy_checkout_header(context): + banners = Banner.choice('seasonal-overlay', request=context['request'], exemptions=False) + return { + 'banner': banners.first(), + } diff --git a/src/catalogue/migrations/0058_alter_book_can_sell_mp3.py b/src/catalogue/migrations/0058_alter_book_can_sell_mp3.py new file mode 100644 index 000000000..bd3204194 --- /dev/null +++ b/src/catalogue/migrations/0058_alter_book_can_sell_mp3.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.8 on 2026-04-29 11:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0057_book_can_sell_mp3'), + ] + + operations = [ + migrations.AlterField( + model_name='book', + name='can_sell_mp3', + field=models.BooleanField(default=False, verbose_name='do sprzedaży mp3'), + ), + ] diff --git a/src/club/templates/club/donation_step1.html b/src/club/templates/club/donation_step1.html index d01e69364..4c7292f8c 100644 --- a/src/club/templates/club/donation_step1.html +++ b/src/club/templates/club/donation_step1.html @@ -1,6 +1,16 @@ {% extends 'club/donation_step_base.html' %} +{% load annoy %} {% load chunks %} +{% block donation-form-header %} +{% seasonal_overlay_exists as e %} +{% if e %} +{% annoy_checkout_header %} +{% else %} +{{ block.super }} +{% endif %} +{% endblock %} + {% block donation-step-content %} {% include "club/donation_step1_form.html" %} {% endblock %} diff --git a/src/club/templates/club/donation_step_base.html b/src/club/templates/club/donation_step_base.html index 0c99d3ca9..e2cec7ac2 100644 --- a/src/club/templates/club/donation_step_base.html +++ b/src/club/templates/club/donation_step_base.html @@ -29,12 +29,14 @@
+ {% block donation-form-header %}
{% chunk "donate-top" %}
+ {% endblock %}
diff --git a/src/wolnelektury/static/2022/styles/layout/_annoy.scss b/src/wolnelektury/static/2022/styles/layout/_annoy.scss index f6b619a76..18c8df847 100644 --- a/src/wolnelektury/static/2022/styles/layout/_annoy.scss +++ b/src/wolnelektury/static/2022/styles/layout/_annoy.scss @@ -362,3 +362,85 @@ justify-content: space-between; } } + + +.t-relative { + position: relative; +} +.annoy-banner_seasonal-overlay { + display: none; + + background-color: #ffd430; + color: #083F4D; + border-radius: 0 0 10px 10px; + position: absolute; + z-index: 1000; + left: 16px; + right: 16px; + padding: 15px 20px; + margin-top: -10px; + + &:before { + background: rgba(0,0,0,0); + height: 10px; + display: block; + content: ""; + position: absolute; + bottom: 0; + left: 0; + right: 0; + border-radius: 0 0 10px 10px; + box-shadow: 0px 10px 10px black; + z-index: 999; + } + + .annoy-banner-inner { + display: flex; + flex-direction: column; + gap: 20px; + align-items: flex-start; + justify-content: space-between; + + @include rwd($break-flow) { + flex-direction: row; + } + + .annoy-banner-off { + background: none; + border-color: transparent; + + position: absolute; + top: 16px; + right: 16px; + padding: 12px 4px; + } + + video { + height: 240px; + width: 100%; + @include rwd($break-flow) { + height: 360px; + width: auto; + } + } + + .text { + margin-right: 60px; + h1 { + font-size: 1.5em; + margin: 0 0 1em; + font-weight: bold; + } + + p { + margin: 1em 0; + } + .l-button { + display: inline-block; + margin-top: 1em; + padding: 12px 20px; + } + } + + } +} diff --git a/src/wolnelektury/static/2022/styles/layout/_checkout.scss b/src/wolnelektury/static/2022/styles/layout/_checkout.scss index 3b1ce0634..135c65310 100644 --- a/src/wolnelektury/static/2022/styles/layout/_checkout.scss +++ b/src/wolnelektury/static/2022/styles/layout/_checkout.scss @@ -64,51 +64,71 @@ } .l-checkout__box__header { - display: flex; + display: flex; + flex-direction: column; background: #083F4D; + @include rwd($break-flow) { + flex-direction: row; + } + .l-checkout__box__header__img { display: none; + background: black; background-position: center; background-size: cover; @include rwd($break-flow) { display: block; width: 50%; } - } -} -.l-checkout__box__header__content h1 { - font-style: italic; - font-weight: 300; - font-size: 48px; - line-height: 55px; - letter-spacing: -0.02em; - color: #92BD39; - margin: 0; + &.l-checkout__box__header__real { + display: block; + width: auto; + + video { + height: 200px; + width: 100%; + display: block; + @include rwd($break-flow) { + height: 360px; + width: auto; + } + } + } + } } -.l-checkout__box__header__content p:first-of-type { - font-style: normal; - font-weight: 600; - font-size: 21.5px; - line-height: 140%; - letter-spacing: -0.01em; - color: #FFFFFF; - margin-top: 23px; -} +.l-checkout__box__header__content { + color: white; + padding: 32px 45px; + + h1 { + font-style: italic; + font-weight: 300; + font-size: 48px; + line-height: 55px; + letter-spacing: -0.02em; + color: #92BD39; + margin: 0; + } -.l-checkout__box__header__content p { - font-weight: normal; - font-size: 18px; - line-height: 150%; - color: #FFFFFF; - margin-top: 8px; + p { + font-weight: normal; + font-size: 18px; + line-height: 150%; + margin-top: 8px; + + &:first-of-type { + font-weight: 600; + font-size: 21.5px; + line-height: 140%; + letter-spacing: -0.01em; + margin-top: 23px; + } + } } -.l-checkout__box__header__content { - padding: 32px 45px; -} //Steps .l-checkout__steps { diff --git a/src/wolnelektury/templates/base.html b/src/wolnelektury/templates/base.html index cf921fbe3..2f7b99f4d 100644 --- a/src/wolnelektury/templates/base.html +++ b/src/wolnelektury/templates/base.html @@ -40,6 +40,7 @@ {% endif %} {% annoy_banner_seasonal %} + {% annoy_banner_seasonal_overlay %} {% block global-content %}