From 1afad6da84bb328ea3b397e4e4ac2dbd3c596152 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 17 Nov 2025 16:21:09 +0100 Subject: [PATCH 01/16] fix --- src/wolnelektury/static/2022/styles/layout/_annoy.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wolnelektury/static/2022/styles/layout/_annoy.scss b/src/wolnelektury/static/2022/styles/layout/_annoy.scss index b02cbafee..157e4e2b5 100644 --- a/src/wolnelektury/static/2022/styles/layout/_annoy.scss +++ b/src/wolnelektury/static/2022/styles/layout/_annoy.scss @@ -271,7 +271,6 @@ } a { line-height: 1.35; - flex-grow: 1; color: #c32721; white-space: nowrap; border: solid #c32721; -- 2.20.1 From 3ed0c5f12103a5b6e6f3e21ff592e9d1c475d5d0 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 25 Nov 2025 14:39:30 +0100 Subject: [PATCH 02/16] hide support button in narrow menu --- src/wolnelektury/static/2022/styles/layout/_navigation.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wolnelektury/static/2022/styles/layout/_navigation.scss b/src/wolnelektury/static/2022/styles/layout/_navigation.scss index 275286b3a..a47875b1a 100644 --- a/src/wolnelektury/static/2022/styles/layout/_navigation.scss +++ b/src/wolnelektury/static/2022/styles/layout/_navigation.scss @@ -276,6 +276,10 @@ body { display: block; left: 16px; } + + .menubar-donate { + display: none; + } } } } -- 2.20.1 From 0188fd570c9698cf2e3a3ee41df142f33329cb38 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 25 Nov 2025 16:35:09 +0100 Subject: [PATCH 03/16] add book-page-center banner --- src/annoy/admin.py | 3 ++ ...anner_books_alter_banner_place_and_more.py | 38 +++++++++++++++++++ src/annoy/models.py | 26 ++++++++++++- src/annoy/places.py | 1 + src/annoy/templates/annoy/banner.html | 8 ++-- src/annoy/templatetags/annoy.py | 4 +- .../templates/catalogue/book_detail.html | 15 +------- .../static/2022/styles/layout/_annoy.scss | 20 ++++++++++ 8 files changed, 95 insertions(+), 20 deletions(-) create mode 100644 src/annoy/migrations/0019_campaign_banner_books_alter_banner_place_and_more.py diff --git a/src/annoy/admin.py b/src/annoy/admin.py index ab7be6aca..ed651b2c5 100644 --- a/src/annoy/admin.py +++ b/src/annoy/admin.py @@ -5,6 +5,9 @@ from modeltranslation.admin import TranslationAdmin from . import models +admin.site.register(models.Campaign) + + class BannerAdmin(TranslationAdmin): list_display = [ 'place', 'text', diff --git a/src/annoy/migrations/0019_campaign_banner_books_alter_banner_place_and_more.py b/src/annoy/migrations/0019_campaign_banner_books_alter_banner_place_and_more.py new file mode 100644 index 000000000..51e33392f --- /dev/null +++ b/src/annoy/migrations/0019_campaign_banner_books_alter_banner_place_and_more.py @@ -0,0 +1,38 @@ +# Generated by Django 4.0.8 on 2025-11-25 15:13 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0051_book_has_audio'), + ('annoy', '0018_alter_banner_style'), + ] + + operations = [ + migrations.CreateModel( + name='Campaign', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(help_text='Dla zespołu', max_length=255)), + ('image', models.FileField(blank=True, upload_to='annoy/banners/', verbose_name='obraz')), + ], + ), + migrations.AddField( + model_name='banner', + name='books', + field=models.ManyToManyField(blank=True, to='catalogue.book'), + ), + 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')], verbose_name='miejsce'), + ), + migrations.AddField( + model_name='banner', + name='campaign', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='annoy.campaign'), + ), + ] diff --git a/src/annoy/models.py b/src/annoy/models.py index 0d887920d..097872b40 100644 --- a/src/annoy/models.py +++ b/src/annoy/models.py @@ -8,8 +8,18 @@ from django.utils.timezone import now from .places import PLACES, PLACE_CHOICES, STYLES +class Campaign(models.Model): + name = models.CharField(max_length=255, help_text='Dla zespołu') + image = models.FileField('obraz', upload_to='annoy/banners/', blank=True) + + def __str__(self): + return self.name + + class Banner(models.Model): place = models.SlugField('miejsce', choices=PLACE_CHOICES) + campaign = models.ForeignKey(Campaign, models.PROTECT, null=True, blank=True) + style = models.CharField( 'styl', max_length=255, blank=True, choices=STYLES, @@ -32,6 +42,8 @@ class Banner(models.Model): help_text='Bannery z wyższym priorytetem mają pierwszeństwo.') since = models.DateTimeField('od', null=True, blank=True) until = models.DateTimeField('do', null=True, blank=True) + books = models.ManyToManyField('catalogue.Book', blank=True) + target = models.IntegerField('cel', null=True, blank=True) progress = models.IntegerField('postęp', null=True, blank=True) show_members = models.BooleanField('widoczny dla członków klubu', default=False) @@ -49,8 +61,14 @@ class Banner(models.Model): def get_text(self): return Template(self.text).render(Context()) + def get_image(self): + if self.campaign and self.campaign.image: + return self.campaign.image + else: + return self.image + @classmethod - def choice(cls, place, request, exemptions=True): + def choice(cls, place, request, exemptions=True, book=None): Membership = apps.get_model('club', 'Membership') if exemptions and hasattr(request, 'annoy_banner_exempt'): @@ -68,6 +86,12 @@ class Banner(models.Model): until__lt=n ).order_by('-priority', '?') + if book is None: + banners = banners.filter(books=None) + else: + banners = banners.filter(models.Q(books=None) | models.Q(books=book)) + + if not request.user.is_authenticated: banners = banners.filter(only_authenticated=False) diff --git a/src/annoy/places.py b/src/annoy/places.py index 8fa767bba..0de0483b9 100644 --- a/src/annoy/places.py +++ b/src/annoy/places.py @@ -1,6 +1,7 @@ PLACE_DEFINITIONS = [ ('top', 'U góry wszystkich stron', True), ('book-page', 'Strona książki', False), + ('book-page-center', 'Strona książki, środek', False), ('book-text-intermission', 'Przerwa w treści książki', False), ('book-fragment-list', 'Obok listy fragmentów książki', False), ('blackout', 'Blackout', True, ( diff --git a/src/annoy/templates/annoy/banner.html b/src/annoy/templates/annoy/banner.html index 4b2bdcfb8..bfecd9d36 100644 --- a/src/annoy/templates/annoy/banner.html +++ b/src/annoy/templates/annoy/banner.html @@ -11,7 +11,7 @@ annoy-banner annoy-banner_{{ banner.place }} annoy-banner-style_{{ banner.style }} - {% if banner.image %}with-image{% endif %} + {% if banner.get_image %}with-image{% endif %} {% if banner.smallfont %}banner-smallfont{% endif %} " id="annoy-banner-{{ banner.id }}" @@ -24,8 +24,10 @@ {% endif %}
- {% if banner.image %} - + {% if banner.get_image %} +
+ +
{% endif %}
{{ banner.get_text|safe|linebreaks }} diff --git a/src/annoy/templatetags/annoy.py b/src/annoy/templatetags/annoy.py index 25293f1ca..cdf4dbc5d 100644 --- a/src/annoy/templatetags/annoy.py +++ b/src/annoy/templatetags/annoy.py @@ -7,8 +7,8 @@ register = template.Library() @register.inclusion_tag('annoy/banner.html', takes_context=True) -def annoy_banner(context, place): - banners = Banner.choice(place, request=context['request']) +def annoy_banner(context, place, **kwargs): + banners = Banner.choice(place, request=context['request'], **kwargs) return { 'banner': banners.first(), 'closable': PLACES.get(place, False), diff --git a/src/catalogue/templates/catalogue/book_detail.html b/src/catalogue/templates/catalogue/book_detail.html index b648fac68..ccce18bf8 100644 --- a/src/catalogue/templates/catalogue/book_detail.html +++ b/src/catalogue/templates/catalogue/book_detail.html @@ -349,20 +349,7 @@ {% if accessible %} -
-
-

- {% blocktrans trimmed %} - Ta książka jest dostępna dla tysięcy dzieciaków dzięki - darowiznom od osób takich jak Ty! - {% endblocktrans %} -

- {% trans "Dorzuć się!" %} -
-
- -
-
+ {% annoy_banner 'book-page-center' book=book %} {% endif %}
{% endwith %} diff --git a/src/wolnelektury/static/2022/styles/layout/_annoy.scss b/src/wolnelektury/static/2022/styles/layout/_annoy.scss index 157e4e2b5..f0885348c 100644 --- a/src/wolnelektury/static/2022/styles/layout/_annoy.scss +++ b/src/wolnelektury/static/2022/styles/layout/_annoy.scss @@ -283,3 +283,23 @@ } } } + +.annoy-banner_book-page-center { + background: white; + margin-top: 20px; + padding: 20px; + border: 1px solid #018189; + border-radius: 15px; + color:#018189; + + .annoy-banner-inner { + display: flex; + gap: 15px; + img { + max-width: 200px; + } + p { + margin: 0; + } + } +} -- 2.20.1 From 17418fd3bdb79dee5d9d232a906a019ecb2096d6 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 25 Nov 2025 16:48:55 +0100 Subject: [PATCH 04/16] fix banner sizing --- src/wolnelektury/static/2022/styles/layout/_annoy.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wolnelektury/static/2022/styles/layout/_annoy.scss b/src/wolnelektury/static/2022/styles/layout/_annoy.scss index f0885348c..94ee021e2 100644 --- a/src/wolnelektury/static/2022/styles/layout/_annoy.scss +++ b/src/wolnelektury/static/2022/styles/layout/_annoy.scss @@ -295,8 +295,10 @@ .annoy-banner-inner { display: flex; gap: 15px; + align-items: center; + img { - max-width: 200px; + width: 150px; } p { margin: 0; -- 2.20.1 From 42017af0c73cff15604489fff492412a4caa161a Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 26 Nov 2025 15:59:59 +0100 Subject: [PATCH 05/16] more margin --- src/wolnelektury/static/2022/styles/layout/_annoy.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wolnelektury/static/2022/styles/layout/_annoy.scss b/src/wolnelektury/static/2022/styles/layout/_annoy.scss index 94ee021e2..5c7649835 100644 --- a/src/wolnelektury/static/2022/styles/layout/_annoy.scss +++ b/src/wolnelektury/static/2022/styles/layout/_annoy.scss @@ -286,7 +286,7 @@ .annoy-banner_book-page-center { background: white; - margin-top: 20px; + margin-top: 50px; padding: 20px; border: 1px solid #018189; border-radius: 15px; -- 2.20.1 From 003b3eecdce065c16cf0e3af23763ae735d4e4ef Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 28 Nov 2025 11:08:06 +0100 Subject: [PATCH 06/16] add contacts export --- src/club/admin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/club/admin.py b/src/club/admin.py index 442592803..8620e7407 100644 --- a/src/club/admin.py +++ b/src/club/admin.py @@ -11,6 +11,7 @@ from django.utils.safestring import mark_safe from fnpdjango.actions import export_as_csv_action from modeltranslation.admin import TranslationAdmin import annoy.models +from messaging.models import Contact, Level from wolnelektury.utils import YesNoFilter from . import models @@ -127,6 +128,11 @@ class CrisisFilter(admin.SimpleListFilter): ) +class OptOutFilter(YesNoFilter): + title = 'opt out' + parameter_name = 'optout' + q = Q(email__in=Contact.objects.filter(level=Level.OPT_OUT).values_list('email', flat=True)) + class ScheduleAdmin(admin.ModelAdmin): form = ScheduleForm @@ -139,6 +145,7 @@ class ScheduleAdmin(admin.ModelAdmin): search_fields = ['email', 'source'] list_filter = [ 'is_cancelled', 'monthly', 'yearly', 'method', + 'consent', OptOutFilter, PayedFilter, ActiveFilter, ExpiredFilter, SourceFilter, CrisisFilter ] -- 2.20.1 From 55d94d75dff5d3a30dd0cce7554e68d23627376d Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 2 Dec 2025 16:15:09 +0100 Subject: [PATCH 07/16] Change donation form --- src/club/forms.py | 5 ++- src/club/models.py | 9 ++++ src/club/templates/club/donation_infobox.html | 8 ++++ .../templates/club/donation_step1_form.html | 10 ++--- src/club/templates/club/donation_step2.html | 12 ++--- src/club/templates/club/donation_step3.html | 14 +++++- .../templates/club/donation_step_base.html | 2 +- .../templates/club/payment/paypal_invite.html | 8 +++- src/club/templates/payu/rec_widget.html | 2 +- src/club/urls.py | 1 + src/club/views.py | 13 +++++- .../static/2022/styles/layout/_checkout.scss | 45 ++++++++++++++----- src/wolnelektury/static/js/main.js | 21 ++++++++- 13 files changed, 118 insertions(+), 32 deletions(-) create mode 100644 src/club/templates/club/donation_infobox.html diff --git a/src/club/forms.py b/src/club/forms.py index b75877d49..e0963036a 100644 --- a/src/club/forms.py +++ b/src/club/forms.py @@ -35,6 +35,8 @@ class DonationStep1Form(forms.ModelForm): self.referer = referer super().__init__(*args, **kwargs) club = models.Club.objects.first() + if self.instance.is_custom_amount(): + self.fields['custom_amount'].initial = int(self.instance.amount) if club is not None: self.fields['custom_amount'].widget.attrs['min'] = club.min_amount @@ -50,7 +52,8 @@ class DonationStep1Form(forms.ModelForm): return state def save(self, *args, **kwargs): - self.instance.source = self.referer + if self.referer is not None: + self.instance.source = self.referer return super().save(*args, **kwargs) diff --git a/src/club/models.py b/src/club/models.py index c40428def..77154954b 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -161,6 +161,15 @@ class Schedule(models.Model): club = Club.objects.first() return club.get_description_for_amount(self.amount, self.monthly) + def is_custom_amount(self): + club = Club.objects.first() + if not self.amount: + return False + if self.monthly: + return not club.monthlyamount_set.filter(amount=self.amount).exists() + else: + return not club.singleamount_set.filter(amount=self.amount).exists() + def initiate_payment(self, request): return self.get_payment_method().initiate(request, self) diff --git a/src/club/templates/club/donation_infobox.html b/src/club/templates/club/donation_infobox.html new file mode 100644 index 000000000..6008f0719 --- /dev/null +++ b/src/club/templates/club/donation_infobox.html @@ -0,0 +1,8 @@ +
+
+ Dziękujemy za wybranie comiesięcznej wpłaty. +
+
+ Czy na pewno nie comiesięczna? Zmień na comiesięczną wpłatę. +
+
diff --git a/src/club/templates/club/donation_step1_form.html b/src/club/templates/club/donation_step1_form.html index 033b0ea3f..655febe07 100644 --- a/src/club/templates/club/donation_step1_form.html +++ b/src/club/templates/club/donation_step1_form.html @@ -1,7 +1,7 @@ {% load static %} {% load i18n %} -
+ {% csrf_token %} {{ form.errors }} @@ -23,12 +23,11 @@ {% for amount in amounts.single %}
-

{{ amount.amount }} zł

{% if amount.description %}

{{ amount.description|safe }}

{% endif %} - +
{% endfor %} @@ -42,12 +41,11 @@
{% for amount in amounts.monthly %}
-

{{ amount.amount }} zł {% trans "/mies." context "kwota na miesiąc" %}

{% if amount.description %}

{{ amount.description|safe }}

{% endif %} - +
{% endfor %} @@ -58,7 +56,7 @@
- + {{ form.custom_amount }}
diff --git a/src/club/templates/club/donation_step2.html b/src/club/templates/club/donation_step2.html index 3864ad5a5..562bb40b9 100644 --- a/src/club/templates/club/donation_step2.html +++ b/src/club/templates/club/donation_step2.html @@ -8,26 +8,26 @@ {% block donation-step-content %} -
+

{{ schedule.amount|floatformat }} zł - {% if schedule.monthly %} - {% trans "/mies." context "kwota na miesiąc" %} - {% endif %} + {% trans "/mies." context "kwota na miesiąc" %}

+ {% if schedule.get_description %}

{{ schedule.get_description }}

+ {% endif %}
+ {% include "club/donation_infobox.html" %} + {% csrf_token %} {{ form.errors }} - {{ form.amount }} - {{ form.monthly }}
diff --git a/src/club/templates/club/donation_step3.html b/src/club/templates/club/donation_step3.html index baeee9f80..622252738 100644 --- a/src/club/templates/club/donation_step3.html +++ b/src/club/templates/club/donation_step3.html @@ -8,7 +8,7 @@ {% block donation-step-content %} -
+

@@ -20,9 +20,19 @@

+ {% include "club/donation_infobox.html" %} + + {% if schedule.monthly %} +

Comiesięczna darowizna będzie pobierana automatycznie

+

Możesz z niej zrezygnować w dowolnej chwili, korzystając z linku który dostaniesz mailem.

+ {% endif %} +
-
+ + +
+ {% for method in schedule.get_payment_methods %} {% invite_payment method schedule %} {% endfor %} diff --git a/src/club/templates/club/donation_step_base.html b/src/club/templates/club/donation_step_base.html index cede1b4ca..df5e805cb 100644 --- a/src/club/templates/club/donation_step_base.html +++ b/src/club/templates/club/donation_step_base.html @@ -43,7 +43,7 @@ {% endif %}
1 -

{% trans "Rodzaj wsparcia" %}

+

{% trans "Kwota wsparcia" %}

{% if view.step > 1 and view.step != 4 %} diff --git a/src/club/templates/club/payment/paypal_invite.html b/src/club/templates/club/payment/paypal_invite.html index 5ac0c4cd5..baaf09d81 100644 --- a/src/club/templates/club/payment/paypal_invite.html +++ b/src/club/templates/club/payment/paypal_invite.html @@ -1,5 +1,11 @@ {% load i18n static %} -

{% trans "Wolisz wpłacić przez PayPal?" %}

+

+ {% if schedule.monthly %} + {% trans "Wolisz ustawić comiesięczną darowiznę przez PayPal?" %} + {% else %} + {% trans "Wolisz wpłacić przez PayPal?" %} + {% endif %} +

PayPal diff --git a/src/club/templates/payu/rec_widget.html b/src/club/templates/payu/rec_widget.html index 13cf53b6b..be61a5366 100644 --- a/src/club/templates/payu/rec_widget.html +++ b/src/club/templates/payu/rec_widget.html @@ -1,5 +1,5 @@ {% load i18n %} -

{% trans "Podaj dane karty płatniczej" %}

+

{% trans "Podaj dane karty płatniczej do comiesięcznej darowizny" %}

{% csrf_token %} diff --git a/src/club/urls.py b/src/club/urls.py index 87bfa5a90..c7bab6aee 100644 --- a/src/club/urls.py +++ b/src/club/urls.py @@ -18,6 +18,7 @@ urlpatterns = [ path('plan//zestawienie//', banner_exempt(views.YearSummaryView.as_view()), name='club_year_summary'), path('plan//rodzaj/', banner_exempt(views.DonationStep1.as_view()), name='donation_step1'), path('plan//dane/', banner_exempt(views.DonationStep2.as_view()), name='donation_step2'), + path('plan//ustaw-miesiecznie/', views.set_monthly, name='donation_set_monthly'), path('przylacz//', views.claim, name='club_claim'), path('anuluj//', views.cancel, name='club_cancel'), diff --git a/src/club/views.py b/src/club/views.py index b2657e62f..a55f28481 100644 --- a/src/club/views.py +++ b/src/club/views.py @@ -4,7 +4,7 @@ from django.conf import settings from django.contrib.auth.decorators import login_required, permission_required from django.db.models import Sum -from django.http import HttpResponse, HttpResponseRedirect +from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.shortcuts import get_object_or_404, render from django.urls import reverse from django.utils.decorators import method_decorator @@ -59,6 +59,17 @@ class DonationStep2(UpdateView): return c +def set_monthly(request, key): + schedule = get_object_or_404(models.Schedule, payed_at=None, key=key) + if request.POST: + schedule.monthly = True + schedule.save(update_fields=['monthly']) + return JsonResponse({ + "amount": schedule.amount, + "monthly": schedule.monthly, + }) + + class JoinView(CreateView): form_class = forms.DonationStep1Form template_name = 'club/donation_step1.html' diff --git a/src/wolnelektury/static/2022/styles/layout/_checkout.scss b/src/wolnelektury/static/2022/styles/layout/_checkout.scss index 593794b5b..636580a1a 100644 --- a/src/wolnelektury/static/2022/styles/layout/_checkout.scss +++ b/src/wolnelektury/static/2022/styles/layout/_checkout.scss @@ -349,26 +349,35 @@ } } button { - height: 56px; + margin: 0; + font-family: "Source Sans Pro",sans-serif; + font-weight: bold; + font-size: 44px; + line-height: 130%; + letter-spacing: -0.01em; + height: 90px; + display: flex; + align-items: center; + justify-content: center; + transition: all $ease-out 250ms; + background: #FFFFFF; border: 1px solid #92BD39; border-radius: 3px; width: 100%; outline: 0; cursor: pointer; - font-weight: 600; - font-size: 16px; - line-height: 24px; - display: flex; - align-items: center; - justify-content: center; text-align: center; color: #083F4D; - transition: background $ease-out 250ms; - @include rwd($break-flow) { - font-size: 20px; - line-height: 25px; + span { + font-weight: 600; + font-size: 25px; + line-height: 200%; + letter-spacing: -0.01em; + color: #92BD39; + margin-left: 10px; + transition: opacity $ease-out 250ms; } &:hover { @@ -397,6 +406,9 @@ &:hover { background: #83AD2B; } + span { + color: white; + } } } @@ -1046,3 +1058,14 @@ } } } + + +.if-monthly { display: none; } +.is-monthly { + .if-monthly { + display: block; + } + .if-not-monthly { + display: none; + } +} diff --git a/src/wolnelektury/static/js/main.js b/src/wolnelektury/static/js/main.js index 45a41970c..a27d97171 100644 --- a/src/wolnelektury/static/js/main.js +++ b/src/wolnelektury/static/js/main.js @@ -338,8 +338,25 @@ $('input', container).val($(this).val()); $('.is-active', container).removeClass('is-active'); $(this).closest('.l-checkout__payments__box').addClass('is-active'); - $('#kwota').val(''); - return false; + $('#id_custom_amount').val(''); + }); + + $('.donation-mod-monthly').on('click', function() { + $.ajax({ + method: 'POST', + data: { + csrfmiddlewaretoken: $("[name=csrfmiddlewaretoken]").val(), + }, + url: $(this).data('url'), + success: function(data) { + if ($(".q-reload-is-monthly").length) { + window.location.reload() + } else { + $(".q-is-monthly").toggleClass('is-monthly', data.monthly); + } + } + }); + return false; }); })(); -- 2.20.1 From 882b3544a066d4c7692c5311dbde85b67a240482 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 2 Dec 2025 16:26:58 +0100 Subject: [PATCH 08/16] fix cache --- src/club/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/club/views.py b/src/club/views.py index a55f28481..679e57548 100644 --- a/src/club/views.py +++ b/src/club/views.py @@ -30,6 +30,7 @@ class ClubView(TemplateView): +@method_decorator(never_cache, name='dispatch') class DonationStep1(UpdateView): queryset = models.Schedule.objects.filter(payed_at=None) form_class = forms.DonationStep1Form @@ -46,6 +47,7 @@ class DonationStep1(UpdateView): return reverse('donation_step2', args=[self.object.key]) +@method_decorator(never_cache, name='dispatch') class DonationStep2(UpdateView): queryset = models.Schedule.objects.filter(payed_at=None) form_class = forms.DonationStep2Form -- 2.20.1 From aba451da713f7acbed28f379aa92c8e116d262f3 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 3 Dec 2025 14:40:40 +0100 Subject: [PATCH 09/16] fixes #OG-196: clear buttons on custom amount --- src/club/templates/club/donation_step1_form.html | 4 ++-- src/wolnelektury/static/js/main.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/club/templates/club/donation_step1_form.html b/src/club/templates/club/donation_step1_form.html index 655febe07..e30fff8b2 100644 --- a/src/club/templates/club/donation_step1_form.html +++ b/src/club/templates/club/donation_step1_form.html @@ -21,7 +21,7 @@ {% with amounts=club.get_amounts %}
{% for amount in amounts.single %} -
+
{% if amount.description %} @@ -40,7 +40,7 @@
{% for amount in amounts.monthly %} -
+
{% if amount.description %}

{{ amount.description|safe }}

diff --git a/src/wolnelektury/static/js/main.js b/src/wolnelektury/static/js/main.js index a27d97171..076277e98 100644 --- a/src/wolnelektury/static/js/main.js +++ b/src/wolnelektury/static/js/main.js @@ -341,6 +341,14 @@ $('#id_custom_amount').val(''); }); + $('#id_custom_amount').on('input', function() { + if ($(this).val() > 0) { + $('.l-checkout__payments__box.is-active').removeClass('is-active'); + } else { + $('.l-checkout__payments__box.initial-active').addClass('is-active'); + } + }); + $('.donation-mod-monthly').on('click', function() { $.ajax({ method: 'POST', -- 2.20.1 From 91ba5726e2ac4051c407127f47f503a3653f0942 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 3 Dec 2025 14:50:34 +0100 Subject: [PATCH 10/16] move some text to chunks --- src/club/templates/club/donation_step_base.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/club/templates/club/donation_step_base.html b/src/club/templates/club/donation_step_base.html index df5e805cb..804ace3f8 100644 --- a/src/club/templates/club/donation_step_base.html +++ b/src/club/templates/club/donation_step_base.html @@ -31,9 +31,7 @@
Wspieraj Wolne Lektury
-

{% trans "Wspieraj Wolne Lektury" %}

-

{% trans "Dziękujemy, że chcesz razem z nami uwalniać książki!" %}

-

{% trans "Wspieraj Wolne Lektury stałą wpłatą – nawet niewielka ma wielką moc! Możesz też wesprzeć Wolne Lektury jednorazowo." %}

+ {% chunk "donate-top" %}
@@ -84,6 +82,8 @@