From fbe0f421e3eef997ed79a0d8d8443bf84ae205b3 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 11 May 2023 16:49:27 +0200 Subject: [PATCH 01/16] Checkout style --- src/club/models.py | 26 +++-- .../club/2022/donation_step1_form.html | 25 +++-- .../static/2022/styles/layout/_checkout.scss | 100 ++++++++++++------ 3 files changed, 93 insertions(+), 58 deletions(-) diff --git a/src/club/models.py b/src/club/models.py index 8338b554b..98b4ee00e 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -44,21 +44,27 @@ class Club(models.Model): for tag, amounts in ('single', single), ('monthly', monthly): wide_spot = narrow_spot = 0 for i, p in enumerate(amounts): - if p.description or p.wide: - if not p.description: - p.narrow_wide = True - if narrow_spot == 1: - amounts[i-1].narrow_wide = True - narrow_spot = 0 if p.wide: - if wide_spot == 2: - p.wide_not_wide = True - wide_spot += 1 - else: + # Do we have space for xl? + if wide_spot < 2: + p.box_variant = 'xl' wide_spot += 2 + else: + p.box_variant = 'card' + wide_spot += 1 + narrow_spot = 0 + elif p.description: + p.box_variant = 'card' + if narrow_spot: + amounts[i-1].box_variant = 'bar' + wide_spot += 1 + narrow_spot = 0 else: + p.box_variant = 'half' wide_spot += 1 + narrow_spot += 1 wide_spot %= 3 + narrow_spot %= 2 c[tag] = amounts c[f'{tag}_wide_spot'] = wide_spot return c diff --git a/src/club/templates/club/2022/donation_step1_form.html b/src/club/templates/club/2022/donation_step1_form.html index 2f9886959..cfdd5d387 100644 --- a/src/club/templates/club/2022/donation_step1_form.html +++ b/src/club/templates/club/2022/donation_step1_form.html @@ -20,18 +20,15 @@ {% with amounts=club.get_amounts %}
{% for amount in amounts.single %} -
-
-

{{ amount.amount }} zł

-
- -
-
- {% if amount.description %} -
+
+ +

{{ amount.amount }} zł

+
+ {% if amount.description %}

{{ amount.description|safe }}

-
- {% endif %} + {% endif %} + +
{% endfor %} {% for amount in amounts.monthly %} -
+

{{ amount.amount }} zł /mies.

-

{{ amount.description|safe }}

+ {% if amount.description %} +

{{ amount.description|safe }}

+ {% endif %}
diff --git a/src/wolnelektury/static/2022/styles/layout/_checkout.scss b/src/wolnelektury/static/2022/styles/layout/_checkout.scss index b4423dda4..779324ae6 100644 --- a/src/wolnelektury/static/2022/styles/layout/_checkout.scss +++ b/src/wolnelektury/static/2022/styles/layout/_checkout.scss @@ -275,13 +275,8 @@ transition: box-shadow $ease-out 250ms; box-shadow: 0px 0px 0px rgba(55, 170, 156, 0); margin-bottom: 30px; - width: calc(50% - 8px); + width: 100%; - &.narrow-wide { - flex-direction: row; - width: 100%; - } - @include rwd($break-flow) { width: calc(33.333% - 20px); } @@ -357,13 +352,9 @@ &.is-active { box-shadow: 0px 0px 20px rgba(55, 170, 156, 0.35); - background: #083F4D; - color: white; + background: white; + color: black; - @include rwd($break-flow) { - background: white; - color: black; - } h3 { color: white; background: #083F4D; @@ -377,23 +368,77 @@ } } + &.l-checkout__payments__box--half { + width: calc(50% - 8px); + @include rwd($break-flow) { + width: calc(33.333% - 20px); + } + + &.is-active { + background: #083F4D; + color: white; + + @include rwd($break-flow) { + background: white; + color: black; + } + } + } + &.l-checkout__payments__box--bar { + flex-direction: row; + + @include rwd($break-flow) { + flex-direction: column; + } + + &.is-active { + background: #083F4D; + color: white; + + @include rwd($break-flow) { + background: white; + color: black; + } + } + + h3, .l-checkout__payments__box__btn-wrp { + flex-grow: 1; + } + } + &.l-checkout__payments__box--card { + } + &.l-checkout__payments__box--xl { width: 100%; + justify-content: center; + min-height: 160px; + @include rwd($break-flow) { width: calc(67.4% - 20px); - width: calc(67.4% - 20px); - flex-direction: row; - & > div { - display: flex; - &:first-child { - width: 50%; + padding-left: calc(33.7% - 10px); + position: relative; + + h3 { + position: absolute; + left: 0; + top: 0; + padding-right: 50%; + } + + .l-checkout__payments__box__btn-wrp { + margin: 0; + + p { flex-wrap: wrap; max-width: 340px; margin-right: 20px; } - &:last-child { - width: 49%; + button { + position: absolute; + bottom: 20px; + left: 20px; + width: calc(50% - 50px); align-items: center; justify-content: center; } @@ -915,18 +960,3 @@ } } } - - -.payments-recurring { - .l-checkout__payments__box { - width: 100%; - &.is-active { - background: white; - color: black; - } - @include rwd($break-flow) { - width: calc(33.333% - 20px); - //margin-right: 30px; - } - } -} -- 2.20.1 From 9b913776e3da4d4879c001b9379808897273c8fd Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 15 May 2023 15:30:32 +0200 Subject: [PATCH 02/16] Download box in mobile. --- .../static/2022/styles/components/_media.scss | 32 +++++++++++++++---- .../2022/styles/layout/_navigation.scss | 12 +++++-- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/wolnelektury/static/2022/styles/components/_media.scss b/src/wolnelektury/static/2022/styles/components/_media.scss index 576174be9..e52708b87 100644 --- a/src/wolnelektury/static/2022/styles/components/_media.scss +++ b/src/wolnelektury/static/2022/styles/components/_media.scss @@ -89,9 +89,13 @@ background-color: rgba($color-black, 0.35); display: none; overflow-y: scroll; - padding: 10vh 40px 40px 40px; + padding: 10vh 16px 10px 10px; width: 100%; + @include rwd($break-flow) { + padding: 10vh 40px 40px 40px; + } + &.is-open { display: flex; } @@ -99,16 +103,23 @@ .c-media__popup__box { background-color: #fff; - min-width: 640px; position: relative; border-radius: 10px; overflow: hidden; + + @include rwd($break-flow) { + min-width: 640px; + } } .c-media__popup__box__lead { - padding: 40px; + padding: 16px 50px 16px 16px; background: #083F4D; + @include rwd($break-flow) { + padding: 40px; + } + h2 { margin-top: 0; font-weight: 600; @@ -129,13 +140,17 @@ } .c-media__popup__box__items { - padding: 40px; + padding: 16px; + @include rwd($break-flow) { + padding: 40px; + } } .c-media__popup__box__item { display: flex; align-items: center; justify-content: space-between; + column-gap: 16px; width: 100%; padding: 20px 0; @@ -215,14 +230,19 @@ cursor: pointer; font-size: 0; background-color: transparent; - top: 35px; - right: 40px; + top: 15px; + right: 20px; transition: all $ease-dynamic 350ms; opacity: 0.75; &:hover { opacity: 1; } + + @include rwd($break-flow) { + top: 35px; + right: 40px; + } } .book-cover-small img { diff --git a/src/wolnelektury/static/2022/styles/layout/_navigation.scss b/src/wolnelektury/static/2022/styles/layout/_navigation.scss index f27b70e54..12b236a64 100644 --- a/src/wolnelektury/static/2022/styles/layout/_navigation.scss +++ b/src/wolnelektury/static/2022/styles/layout/_navigation.scss @@ -55,7 +55,6 @@ body { .l-navigation__logo { display: flex; position: relative; - z-index: $master-layer + 1; img { width: 153px; @@ -73,9 +72,18 @@ body { margin: 0; outline: 0; position: relative; - z-index: $master-layer + 1; } +.is-open { + .l-navigation__logo { + z-index: $master-layer + 1; + } + .l-navigation__button { + z-index: $master-layer + 1; + } +} + + .l-naviagion__search { width: 60%; max-width: 580px; -- 2.20.1 From 031b8be3bf03baa724dd7e225b0555726d089341 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 23 May 2023 12:15:15 +0200 Subject: [PATCH 03/16] Add missing constraint. --- ...0006_alter_bookuserdata_unique_together.py | 20 +++++++++++++++++++ src/api/models.py | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 src/api/migrations/0006_alter_bookuserdata_unique_together.py diff --git a/src/api/migrations/0006_alter_bookuserdata_unique_together.py b/src/api/migrations/0006_alter_bookuserdata_unique_together.py new file mode 100644 index 000000000..58d4b9a6b --- /dev/null +++ b/src/api/migrations/0006_alter_bookuserdata_unique_together.py @@ -0,0 +1,20 @@ +# Generated by Django 4.0.8 on 2023-05-23 09:10 + +from django.conf import settings +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0043_alter_bookmedia_duration_alter_bookmedia_type'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('api', '0005_consumer_nonce_resource_token'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='bookuserdata', + unique_together={('user', 'book')}, + ), + ] diff --git a/src/api/models.py b/src/api/models.py index eb234ad8b..ffa4f9be2 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -50,6 +50,9 @@ class BookUserData(models.Model): complete = models.BooleanField(default=False) last_changed = models.DateTimeField(auto_now=True) + class Meta: + unique_together = [('user', 'book')] + @property def state(self): return 'complete' if self.complete else 'reading' -- 2.20.1 From 9d763695198b109f00b5d88a5cfe0190871271aa Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 23 May 2023 12:24:23 +0200 Subject: [PATCH 04/16] Fixes and experiments. --- src/catalogue/views.py | 15 ++++++++------- src/experiments/base.py | 14 ++++++++------ src/experiments/experiments.py | 8 ++++++++ .../templates/experiments/main_switch.html | 2 ++ src/wolnelektury/settings/custom.py | 1 + src/wolnelektury/templates/2022/main_page.html | 3 ++- src/wolnelektury/views.py | 4 ++++ 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/catalogue/views.py b/src/catalogue/views.py index 16b66f0fb..2b188e684 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -109,13 +109,14 @@ def object_list(request, objects, fragments=None, related_tags=None, tags=None, Tag.objects.usage_for_queryset( objects, counts=True ).exclude(category='set').exclude(pk__in=tag_ids)) - related_tag_lists.append( - Tag.objects.usage_for_queryset( - objects, counts=True - ).filter( - user=request.user - ).exclude(name='').exclude(pk__in=tag_ids) - ) + if request.user.is_authenticated: + related_tag_lists.append( + Tag.objects.usage_for_queryset( + objects, counts=True + ).filter( + user=request.user + ).exclude(name='').exclude(pk__in=tag_ids) + ) if not (extra and extra.get('theme_is_set')): if fragments is None: if list_type == 'gallery': diff --git a/src/experiments/base.py b/src/experiments/base.py index 726f451cd..92b1bc1bd 100644 --- a/src/experiments/base.py +++ b/src/experiments/base.py @@ -7,6 +7,7 @@ class Experiment: name = 'experiment' explicit = False size = 0 + switchable = True def qualify(self, request): return True @@ -27,12 +28,13 @@ class Experiment: if self.qualify(request) is False: return None, False - cookie_value = request.COOKIES.get(f'EXPERIMENT_{slug}') - if cookie_value is not None: - if cookie_value == 'on': - return True, True - elif cookie_value == 'off': - return False, True + if self.switchable or request.user.is_staff: + cookie_value = request.COOKIES.get(f'EXPERIMENT_{slug}') + if cookie_value is not None: + if cookie_value == 'on': + return True, True + elif cookie_value == 'off': + return False, True number = int( hashlib.md5( diff --git a/src/experiments/experiments.py b/src/experiments/experiments.py index df1b23a4a..15c103ff7 100644 --- a/src/experiments/experiments.py +++ b/src/experiments/experiments.py @@ -14,6 +14,14 @@ class NewLayout(Experiment): return False +class Sowka(Experiment): + slug = 'sowka' + name = 'Pan Sówka' + size = settings.EXPERIMENTS_SOWKA + switchable = False + + experiments = [ NewLayout, + Sowka, ] diff --git a/src/experiments/templates/experiments/main_switch.html b/src/experiments/templates/experiments/main_switch.html index c02ca488a..7638e1f76 100644 --- a/src/experiments/templates/experiments/main_switch.html +++ b/src/experiments/templates/experiments/main_switch.html @@ -9,6 +9,7 @@ {% for exp in request.EXPERIMENTS.values %} + {% if exp.switchable or request.user.is_staff %}
{{ exp.name }} @@ -24,6 +25,7 @@ {% endif %} data-value="off">wyłączony
+ {% endif %} {% endfor %} {% endblock %} diff --git a/src/wolnelektury/settings/custom.py b/src/wolnelektury/settings/custom.py index fa1b8d29a..07c1bfee8 100644 --- a/src/wolnelektury/settings/custom.py +++ b/src/wolnelektury/settings/custom.py @@ -67,5 +67,6 @@ CIVICRM_ACTIVITIES = { } EXPERIMENTS_LAYOUT = 0 +EXPERIMENTS_SOWKA = 0 WIDGETS = {} diff --git a/src/wolnelektury/templates/2022/main_page.html b/src/wolnelektury/templates/2022/main_page.html index 551712390..ca9d9586c 100644 --- a/src/wolnelektury/templates/2022/main_page.html +++ b/src/wolnelektury/templates/2022/main_page.html @@ -141,8 +141,9 @@
{% if widget %} +

{{ widget.description }}

- +
{% endif %} diff --git a/src/wolnelektury/views.py b/src/wolnelektury/views.py index 49110e938..9f099bd3a 100644 --- a/src/wolnelektury/views.py +++ b/src/wolnelektury/views.py @@ -32,12 +32,16 @@ def main_page_2022(request): ctx['recommended_collection'] = Collection.objects.filter(listed=True, role='recommend').order_by('?').first() ctx['ambassadors'] = club.models.Ambassador.objects.all().order_by('?') ctx['widget'] = settings.WIDGETS.get(request.GET.get('w')) + if not ctx['widget'] and request.EXPERIMENTS['sowka'].value: + ctx['widget'] = settings.WIDGETS['pan-sowka'] return render(request, '2022/main_page.html', ctx) @never_cache def main_page(request): if request.GET.get('w') in settings.WIDGETS: request.EXPERIMENTS['layout'].override(True) + if request.EXPERIMENTS['sowka'].value: + request.EXPERIMENTS['layout'].override(True) if request.EXPERIMENTS['layout'].value: return main_page_2022(request) -- 2.20.1 From 9eeeeab0b4b72b405b2c2a6e69969537706535bf Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 23 May 2023 12:32:14 +0200 Subject: [PATCH 05/16] checkout styles --- src/club/models.py | 8 +++ .../club/2022/donation_step1_form.html | 4 +- .../templates/club/2022/donation_step2.html | 7 +- .../templates/club/2022/donation_step3.html | 4 +- .../static/2022/styles/layout/_checkout.scss | 69 ++++++++++++------- 5 files changed, 63 insertions(+), 29 deletions(-) diff --git a/src/club/models.py b/src/club/models.py index 98b4ee00e..676669497 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -69,6 +69,10 @@ class Club(models.Model): c[f'{tag}_wide_spot'] = wide_spot return c + def get_description_for_amount(self, amount, monthly): + amounts = self.monthlyamount_set if monthly else self.singleamount_set + amount = amounts.all().filter(amount__lte=amount).last() + return amount.description if amount is not None else '' class SingleAmount(models.Model): @@ -146,6 +150,10 @@ class Schedule(models.Model): super(Schedule, self).save(*args, **kwargs) self.update_contact() + def get_description(self): + club = Club.objects.first() + return club.get_description_for_amount(self.amount, self.monthly) + def initiate_payment(self, request): return self.get_payment_method().initiate(request, self) diff --git a/src/club/templates/club/2022/donation_step1_form.html b/src/club/templates/club/2022/donation_step1_form.html index cfdd5d387..6b985eded 100644 --- a/src/club/templates/club/2022/donation_step1_form.html +++ b/src/club/templates/club/2022/donation_step1_form.html @@ -80,11 +80,11 @@ Bezpieczne płatności zapewniają:
nazwa odbiorcy
-

Fundacja Nowoczesna Polska

+

Fundacja Wolne Lektury

- +
adres odbiorcy
diff --git a/src/club/templates/club/2022/donation_step2.html b/src/club/templates/club/2022/donation_step2.html index cd7a9f4be..f115ece6b 100644 --- a/src/club/templates/club/2022/donation_step2.html +++ b/src/club/templates/club/2022/donation_step2.html @@ -18,6 +18,7 @@ {% endif %} +

{{ schedule.get_description }}

@@ -105,5 +106,9 @@
- Bezpieczne płatności zapewniają +
+ + Bezpieczne płatności zapewniają: + +
{% endblock %} diff --git a/src/club/templates/club/2022/donation_step3.html b/src/club/templates/club/2022/donation_step3.html index 4da3456df..a368c659b 100644 --- a/src/club/templates/club/2022/donation_step3.html +++ b/src/club/templates/club/2022/donation_step3.html @@ -34,11 +34,11 @@
nazwa odbiorcy
-

Fundacja Nowoczesna Polska

+

Fundacja Wolne Lektury

- +
adres odbiorcy
diff --git a/src/wolnelektury/static/2022/styles/layout/_checkout.scss b/src/wolnelektury/static/2022/styles/layout/_checkout.scss index 779324ae6..89b97f164 100644 --- a/src/wolnelektury/static/2022/styles/layout/_checkout.scss +++ b/src/wolnelektury/static/2022/styles/layout/_checkout.scss @@ -188,11 +188,15 @@ .l-switch label { color: #fff; font-weight: 600; - font-size: 21.5px; + font-size: 18.5px; line-height: 26px; transition: color .2s ease; width: 122px; cursor: pointer; + + @include rwd($break-flow) { + font-size: 21.5px; + } } .l-switch label:nth-of-type(1) { @@ -349,6 +353,12 @@ background: rgba(#92BD39, 0.75); } } + img { + display: none; + @include rwd($break-flow) { + display: block; + } + } &.is-active { box-shadow: 0px 0px 20px rgba(55, 170, 156, 0.35); @@ -527,6 +537,7 @@ span { color: #FF4C54; } } input, select, textarea { + width: 100%; height: 56px; background: #FFFFFF; border: 1px solid #D5ECED; @@ -541,19 +552,25 @@ } button { - height: 56px; + height: 40px; background: #083F4D; + border: none; border-radius: 3px; font-weight: 600; - font-size: 20px; + font-size: 16px; line-height: 25px; display: flex; align-items: center; justify-content: center; text-align: center; - margin-left: 32px; color: #FFFFFF; - width: 340px; + + @include rwd($break-flow) { + height: 56px; + font-size: 20px; + width: 340px; + margin-left: 32px; + } } } @@ -586,7 +603,7 @@ } } &:nth-child(2) { - width: calc(100% - 340px); + width: calc(100% - 402px); } &.full { width: 100%; @@ -635,9 +652,15 @@ } .l-checkout__form__row { - display: flex; + display: flex; + flex-direction: column; + gap: 20px; margin-bottom: 24px; + @include rwd($break-flow) { + flex-direction: row; + } + &:nth-child(4) { .l-checkout__input { &:nth-child(1) { width: 172px; } @@ -647,14 +670,8 @@ &.full { flex-direction: column; - - .l-checkout__input { - &:nth-child(1) { - padding-right: 0; - } - &:nth-child(2) { - padding-left: 0; - } + @include rwd($break-flow) { + flex-direction: column; } } @@ -673,12 +690,6 @@ .l-checkout__input { width: 100%; - &:nth-child(1) { - padding-right: 10px; - } - &:nth-child(2) { - padding-left: 10px; - } } & > a { @@ -694,13 +705,23 @@ } &.confirm { - display: flex; + display: flex; + flex-direction: row; align-items: center; - justify-content: space-between; + justify-content: stretch; width: 100%; + gap: 50px; + @include rwd($break-flow) { + justify-content: space-between; + } + .l-checkout__input { - width: auto; + flex-grow: 1; + @include rwd($break-flow) { + width: auto; + flex-grow: 0; + } } } .errorlist { -- 2.20.1 From 65c77f6685941ec4ac33e46a101d96f709552842 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 23 May 2023 13:13:26 +0200 Subject: [PATCH 06/16] fix --- src/pdcounter/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdcounter/views.py b/src/pdcounter/views.py index c782c0b0f..753c9e425 100644 --- a/src/pdcounter/views.py +++ b/src/pdcounter/views.py @@ -21,7 +21,7 @@ def book_stub_detail(request, slug): if request.EXPERIMENTS['layout'].value: template_name = 'pdcounter/2022/book_detail.html' else: - template_name = 'pdcounter/book_detail.html' + template_name = 'pdcounter/book_stub_detail.html' return render(request, template_name, { 'book': book, -- 2.20.1 From 137adc006b783dc9444d051625ab4d59456840cd Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 23 May 2023 13:26:38 +0200 Subject: [PATCH 07/16] fix --- src/catalogue/models/tag.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/catalogue/models/tag.py b/src/catalogue/models/tag.py index 1051741bd..d77c84376 100644 --- a/src/catalogue/models/tag.py +++ b/src/catalogue/models/tag.py @@ -161,6 +161,8 @@ class Tag(models.Model): # TODO: remove magic. if self.category == 'set': return reverse('social_my_shelf') + elif self.category == 'thing': + return '' else: return reverse(f'{self.category}_catalogue') -- 2.20.1 From 4b2c05eedf0c6b3d213ce0b760d641c345e3c9b3 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 23 May 2023 16:10:28 +0200 Subject: [PATCH 08/16] Layout. --- requirements/requirements.txt | 2 +- .../catalogue/2022/author_detail.html | 2 +- .../templates/catalogue/2022/book_box.html | 2 +- .../templates/catalogue/2022/book_detail.html | 2 +- .../catalogue/2022/book_fragments.html | 78 +++++++++++++++++++ .../catalogue/2022/fragment_box.html | 35 ++++++--- .../catalogue/2022/fragment_slider_box.html | 10 +++ .../catalogue/2022/theme_detail.html | 28 +------ .../templates/catalogue/catalogue.html | 8 +- .../catalogue/recent_audiobooks_list.html | 22 ++++-- .../catalogue/recent_daisy_list.html | 22 ++++-- .../templates/catalogue/recent_list.html | 24 ++++-- src/catalogue/urls.py | 19 +++-- src/catalogue/views.py | 7 +- .../templates/push/notification_form.html | 4 +- .../templates/push/notification_sent.html | 4 +- src/wolnelektury/settings/contrib.py | 1 + src/wolnelektury/templates/forms/p.html | 20 +++++ 18 files changed, 212 insertions(+), 78 deletions(-) create mode 100644 src/catalogue/templates/catalogue/2022/book_fragments.html create mode 100644 src/catalogue/templates/catalogue/2022/fragment_slider_box.html create mode 100644 src/wolnelektury/templates/forms/p.html diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 3fb38a59c..99e11fa09 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -19,7 +19,7 @@ django-admin-ordering==0.16 django-countries==7.3.2 # A version compatible with Django 2.2+, with long help text and editable max_length. --e git+https://github.com/rczajka/django-forms-builder@30beb889cbf297be35963c15501c764a0689b539#egg=django-forms-builder +-e git+https://github.com/rczajka/django-forms-builder@9c5cc4763e586b00b95366299f88f092471b7798#egg=django-forms-builder oauthlib>=3.0.1,<3.1 diff --git a/src/catalogue/templates/catalogue/2022/author_detail.html b/src/catalogue/templates/catalogue/2022/author_detail.html index dc673b26a..120fec425 100644 --- a/src/catalogue/templates/catalogue/2022/author_detail.html +++ b/src/catalogue/templates/catalogue/2022/author_detail.html @@ -95,7 +95,7 @@ {% for fragment in cites %}
- {% include "catalogue/2022/fragment_box.html" %} + {% include "catalogue/2022/fragment_slider_box.html" %}
{% endfor %} diff --git a/src/catalogue/templates/catalogue/2022/book_box.html b/src/catalogue/templates/catalogue/2022/book_box.html index 8aabcd55e..4919ba1ba 100644 --- a/src/catalogue/templates/catalogue/2022/book_box.html +++ b/src/catalogue/templates/catalogue/2022/book_box.html @@ -6,7 +6,7 @@ {% if book.is_picture %} {% if book.image_file %} {% thumbnail book.image_file "170x240" crop="center" as im %} - + {% endthumbnail %} {% endif %} {% else %} diff --git a/src/catalogue/templates/catalogue/2022/book_detail.html b/src/catalogue/templates/catalogue/2022/book_detail.html index 7fd9dcf6a..f0910a542 100644 --- a/src/catalogue/templates/catalogue/2022/book_detail.html +++ b/src/catalogue/templates/catalogue/2022/book_detail.html @@ -370,7 +370,7 @@
{% for fragment in cites %} - {% include "catalogue/2022/fragment_box.html" %} + {% include "catalogue/2022/fragment_slider_box.html" %} {% endfor %}
diff --git a/src/catalogue/templates/catalogue/2022/book_fragments.html b/src/catalogue/templates/catalogue/2022/book_fragments.html new file mode 100644 index 000000000..d1d4f2435 --- /dev/null +++ b/src/catalogue/templates/catalogue/2022/book_fragments.html @@ -0,0 +1,78 @@ +{% extends '2022/base.html' %} +{% load pagination_tags %} + +{% block global-content %} +
+ +
+ +
+ +
+
+

+ Motyw: {{ theme.name }} + w utworze + {{ book }} +

+
+
+ + + + {% autopaginate fragments 10 %} + +
+
+
+
+ + {% for fragment in fragments %} + {% include 'catalogue/2022/fragment_box.html' %} + {% endfor %} + {% paginate using '2022/paginate.html' %} +
+
+
+
+

Motyw: {{ theme.name }}

+ {{ theme.description|safe }} + +
+
+
+
+
+ +{% endblock %} diff --git a/src/catalogue/templates/catalogue/2022/fragment_box.html b/src/catalogue/templates/catalogue/2022/fragment_box.html index 2522ce66e..7371976c3 100644 --- a/src/catalogue/templates/catalogue/2022/fragment_box.html +++ b/src/catalogue/templates/catalogue/2022/fragment_box.html @@ -1,10 +1,27 @@ - - - {% if fragment.short_text %} + diff --git a/src/catalogue/templates/catalogue/2022/fragment_slider_box.html b/src/catalogue/templates/catalogue/2022/fragment_slider_box.html new file mode 100644 index 000000000..2522ce66e --- /dev/null +++ b/src/catalogue/templates/catalogue/2022/fragment_slider_box.html @@ -0,0 +1,10 @@ + + + {% if fragment.short_text %} + {{ fragment.short_text|safe }} + {% else %} + {{ fragment.text|safe }} + {% endif %} + +

{{ fragment.book.pretty_title }}

+
diff --git a/src/catalogue/templates/catalogue/2022/theme_detail.html b/src/catalogue/templates/catalogue/2022/theme_detail.html index 5713cecea..29b0eebfa 100644 --- a/src/catalogue/templates/catalogue/2022/theme_detail.html +++ b/src/catalogue/templates/catalogue/2022/theme_detail.html @@ -46,33 +46,7 @@
{% for fragment in object_list %} - + {% include 'catalogue/2022/fragment_box.html' %} {% endfor %} {% paginate using '2022/paginate.html' %}
diff --git a/src/catalogue/templates/catalogue/catalogue.html b/src/catalogue/templates/catalogue/catalogue.html index bb86b7ac6..935d232fa 100644 --- a/src/catalogue/templates/catalogue/catalogue.html +++ b/src/catalogue/templates/catalogue/catalogue.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout|yesno:"2022/base.html,base/base.html" %} {% load i18n %} {% load catalogue_tags %} @@ -7,9 +7,9 @@ {% block bodyid %}catalogue-catalogue{% endblock %} -{% block body %} +{% block body %}{% block main %}

{% trans "All works" %}

-
+ -{% endblock %} +{% endblock %}{% endblock %} diff --git a/src/catalogue/templates/catalogue/recent_audiobooks_list.html b/src/catalogue/templates/catalogue/recent_audiobooks_list.html index a597f0b88..b600936f8 100644 --- a/src/catalogue/templates/catalogue/recent_audiobooks_list.html +++ b/src/catalogue/templates/catalogue/recent_audiobooks_list.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout|yesno:"2022/base.html,base/base.html" %} {% load i18n %} {% load catalogue_tags %} @@ -6,10 +6,20 @@ {% block bodyid %}recent-list{% endblock %} -{% block body %} +{% block body %}{% block main %}

{% trans "Recent audiobooks" %}

-
- {% work_list object_list %} -
-{% endblock %} + {% if request.EXPERIMENTS.layout %} +
+
+ {% for book in object_list %} + {% include "catalogue/2022/book_box.html" %} + {% endfor %} +
+
+ {% else %} +
+ {% work_list object_list %} +
+ {% endif %} +{% endblock %}{% endblock %} diff --git a/src/catalogue/templates/catalogue/recent_daisy_list.html b/src/catalogue/templates/catalogue/recent_daisy_list.html index 2b0ab83ed..fe6be3bb1 100644 --- a/src/catalogue/templates/catalogue/recent_daisy_list.html +++ b/src/catalogue/templates/catalogue/recent_daisy_list.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout|yesno:"2022/base.html,base/base.html" %} {% load i18n %} {% load catalogue_tags %} @@ -6,10 +6,20 @@ {% block bodyid %}recent-list{% endblock %} -{% block body %} +{% block body %}{% block main %}

{% trans "Recent DAISY files" %}

-
- {% work_list object_list %} -
-{% endblock %} + {% if request.EXPERIMENTS.layout %} +
+
+ {% for book in object_list %} + {% include "catalogue/2022/book_box.html" %} + {% endfor %} +
+
+ {% else %} +
+ {% work_list object_list %} +
+ {% endif %} +{% endblock %}{% endblock %} diff --git a/src/catalogue/templates/catalogue/recent_list.html b/src/catalogue/templates/catalogue/recent_list.html index f0fadb30b..f6b917228 100644 --- a/src/catalogue/templates/catalogue/recent_list.html +++ b/src/catalogue/templates/catalogue/recent_list.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout|yesno:"2022/base.html,base/base.html" %} {% load i18n %} {% load catalogue_tags %} @@ -6,17 +6,27 @@ {% block bodyid %}recent-list{% endblock %} -{% block body %} +{% block body %}{% block main %}

{% trans "Recent publications" %}

{% url 'recent_audiobooks_list' as a %} {% url 'recent_daisy_list' as d %}

{% blocktrans %}You can also see recent audiobooks - and recent DAISY files.{% endblocktrans %} + and recent DAISY files.{% endblocktrans %}

-
- {% work_list object_list %} -
-{% endblock %} + {% if request.EXPERIMENTS.layout %} +
+
+ {% for book in object_list %} + {% include "catalogue/2022/book_box.html" %} + {% endfor %} +
+
+ {% else %} +
+ {% work_list object_list %} +
+ {% endif %} +{% endblock %}{% endblock %} diff --git a/src/catalogue/urls.py b/src/catalogue/urls.py index f8eb6a4b2..7049b1c85 100644 --- a/src/catalogue/urls.py +++ b/src/catalogue/urls.py @@ -14,7 +14,7 @@ import search.views urlpatterns = [ path('obraz/strona/', picture.views.picture_page, name='picture_page'), # pictures - currently pictures are coupled with catalogue, hence the url is here - path('obraz/', picture.views.picture_list_thumb, name='picture_list_thumb'), # TODO: catalogue view + path('obraz/', picture.views.picture_list_thumb, name='picture_list_thumb'), path('obraz/.html', picture.views.picture_viewer, name='picture_viewer'), path('obraz//', picture.views.picture_detail, name='picture_detail'), @@ -22,9 +22,8 @@ urlpatterns = [ path('szukaj/', RedirectView.as_view( url='/szukaj/', query_string=True, permanent=True)), - path('', views.catalogue, name='catalogue'), # TODO catalogue + path('', views.catalogue, name='catalogue'), - # TODO: catalogue path('autor/', views.tag_catalogue, {'category': 'author'}, name='author_catalogue'), path('epoka/', views.tag_catalogue, {'category': 'epoch'}, name='epoch_catalogue'), path('gatunek/', views.tag_catalogue, {'category': 'genre'}, name='genre_catalogue'), @@ -37,16 +36,16 @@ urlpatterns = [ path('lektury/', views.literature, name='book_list'), path('lektury//', views.collection, name='collection'), path('audiobooki/', views.audiobooks, name='audiobook_list'), - path('daisy/', views.daisy_list, name='daisy_list'), # TODO: catalogue + path('daisy/', views.daisy_list, name='daisy_list'), path('jtags/', search.views.hint, {'param': 'q', 'mozhint': True}, name='jhint'), - path('nowe/', ListView.as_view( # TODO - queryset=Book.objects.filter(parent=None, findable=True).order_by('-created_at'), + path('nowe/', ListView.as_view( + queryset=Book.objects.filter(parent=None, findable=True).order_by('-created_at')[:100], template_name='catalogue/recent_list.html'), name='recent_list'), - path('nowe/audiobooki/', ListView.as_view( # TODO - queryset=Book.objects.filter(media__type='ogg').annotate(m=Max('media__uploaded_at')).order_by('-m'), + path('nowe/audiobooki/', ListView.as_view( + queryset=Book.objects.filter(media__type='ogg').annotate(m=Max('media__uploaded_at')).order_by('-m')[:100], template_name='catalogue/recent_audiobooks_list.html'), name='recent_audiobooks_list'), - path('nowe/daisy/', ListView.as_view( # TODO - queryset=Book.objects.filter(media__type='daisy').annotate(m=Max('media__uploaded_at')).order_by('-m'), + path('nowe/daisy/', ListView.as_view( + queryset=Book.objects.filter(media__type='daisy').annotate(m=Max('media__uploaded_at')).order_by('-m')[:100], template_name='catalogue/recent_daisy_list.html'), name='recent_daisy_list'), path('custompdf//', views.CustomPDFFormView(), name='custom_pdf_form'), diff --git a/src/catalogue/views.py b/src/catalogue/views.py index 2b188e684..b4e5920ea 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -299,9 +299,14 @@ def book_fragments(request, slug, theme_slug): fragments = Fragment.tagged.with_all([theme]).filter( Q(book=book) | Q(book__ancestor=book)) + if request.EXPERIMENTS['layout'].value: + template_name = 'catalogue/2022/book_fragments.html' + else: + template_name = 'catalogue/book_fragments.html' + return render( request, - 'catalogue/book_fragments.html', + template_name, { 'book': book, 'theme': theme, diff --git a/src/push/templates/push/notification_form.html b/src/push/templates/push/notification_form.html index e926c9229..09e60550d 100644 --- a/src/push/templates/push/notification_form.html +++ b/src/push/templates/push/notification_form.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} {% block titleextra %}{% trans "Notifications" %}{% endblock %} @@ -14,4 +14,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/push/templates/push/notification_sent.html b/src/push/templates/push/notification_sent.html index 44c29c327..3cf938a5b 100644 --- a/src/push/templates/push/notification_sent.html +++ b/src/push/templates/push/notification_sent.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} {% block titleextra %}{% trans "Notifications" %}{% endblock %} @@ -7,4 +7,4 @@ {% block body %}

Wysłano powiadomienie

Gratulacje!

-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/wolnelektury/settings/contrib.py b/src/wolnelektury/settings/contrib.py index f2247facd..858c4022c 100644 --- a/src/wolnelektury/settings/contrib.py +++ b/src/wolnelektury/settings/contrib.py @@ -53,3 +53,4 @@ FORMS_BUILDER_EXTRA_FIELDS = [ FORMS_BUILDER_HELPTEXT_MAX_LENGTH = 2048 FORMS_BUILDER_REQUIRED_CSS_CLASS = 'required' FORMS_BUILDER_INACTIVE_VISIBLE = True +FORMS_BUILDER_TEMPLATE_NAME_P = 'forms/p.html' diff --git a/src/wolnelektury/templates/forms/p.html b/src/wolnelektury/templates/forms/p.html new file mode 100644 index 000000000..be238bb80 --- /dev/null +++ b/src/wolnelektury/templates/forms/p.html @@ -0,0 +1,20 @@ +{{ errors }} +{% if errors and not fields %} +

{% for field in hidden_fields %}{{ field }}{% endfor %}

+{% endif %} +{% for field, errors in fields %} + {{ errors }} + + {% if field.label %}{{ field.label_tag }}{% endif %} + {% if field.help_text %} +
{{ field.help_text|safe }} + {% endif %} + {{ field }} + {% if forloop.last %} + {% for field in hidden_fields %}{{ field }}{% endfor %} + {% endif %} +

+{% endfor %} +{% if not fields and not errors %} + {% for field in hidden_fields %}{{ field }}{% endfor %} +{% endif %} -- 2.20.1 From 50c611975dd61f638d26d2cf9762477dfb1673c6 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 29 May 2023 18:24:56 +0200 Subject: [PATCH 09/16] minor edit --- src/club/templates/club/2022/donation_step_base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/club/templates/club/2022/donation_step_base.html b/src/club/templates/club/2022/donation_step_base.html index 1b292a80b..03b0b5c01 100644 --- a/src/club/templates/club/2022/donation_step_base.html +++ b/src/club/templates/club/2022/donation_step_base.html @@ -20,7 +20,7 @@
-- 2.20.1 From f546d1dd07dd4d86e1dcde26a1b02f0ffe783f7c Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 29 May 2023 18:39:33 +0200 Subject: [PATCH 10/16] fix --- src/club/templates/club/2022/donation_step_base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/club/templates/club/2022/donation_step_base.html b/src/club/templates/club/2022/donation_step_base.html index 03b0b5c01..d4319ee2d 100644 --- a/src/club/templates/club/2022/donation_step_base.html +++ b/src/club/templates/club/2022/donation_step_base.html @@ -16,7 +16,7 @@
- +
{% endblock %} diff --git a/src/club/templates/club/2022/donation_step_base.html b/src/club/templates/club/2022/donation_step_base.html index d4319ee2d..a87b6c374 100644 --- a/src/club/templates/club/2022/donation_step_base.html +++ b/src/club/templates/club/2022/donation_step_base.html @@ -20,7 +20,7 @@
diff --git a/src/club/templates/payu/rec_widget.html b/src/club/templates/payu/rec_widget.html index 89b114b17..c02cc08f3 100644 --- a/src/club/templates/payu/rec_widget.html +++ b/src/club/templates/payu/rec_widget.html @@ -1,6 +1,6 @@

Podaj dane karty płatniczej

-
+ {% csrf_token %} {{ form }}
diff --git a/src/club/templatetags/club.py b/src/club/templatetags/club.py index be7dda9f2..92fb5ca0b 100644 --- a/src/club/templatetags/club.py +++ b/src/club/templatetags/club.py @@ -80,6 +80,6 @@ def club_monthly_missing_since(start, target): monthly=True, payed_at__gte=start).count() -@register.simple_tag -def invite_payment(payment_method, schedule): - return payment_method.invite_widget(schedule) +@register.simple_tag(takes_context=True) +def invite_payment(context, payment_method, schedule): + return payment_method.invite_widget(schedule, context['request']) -- 2.20.1 From dc55364dde5b1302764a20b3a8d9f9312813ba0c Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 1 Jun 2023 15:18:18 +0200 Subject: [PATCH 13/16] Missing more button. --- src/club/templates/club/2022/donation_step_base.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/club/templates/club/2022/donation_step_base.html b/src/club/templates/club/2022/donation_step_base.html index a87b6c374..fa41f5f03 100644 --- a/src/club/templates/club/2022/donation_step_base.html +++ b/src/club/templates/club/2022/donation_step_base.html @@ -87,6 +87,7 @@
{% chunk 'donation-transparency' %}
+