From: Radek Czajka Date: Thu, 11 May 2023 13:47:16 +0000 (+0200) Subject: layout stuff X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/a98d18bc92d7d28d54c0cc1c1a636c9d79e6a648?ds=sidebyside;hp=b0fadf2591f3af957c1c8e0307d0bcef9e9f8538 layout stuff --- diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 0e16c969e..3fb38a59c 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@6bdb2345cfc02ebf7e0fb049e43e4e0a38b52940#egg=django-forms-builder +-e git+https://github.com/rczajka/django-forms-builder@30beb889cbf297be35963c15501c764a0689b539#egg=django-forms-builder oauthlib>=3.0.1,<3.1 @@ -40,7 +40,7 @@ mutagen==1.45.1 sorl-thumbnail==12.8.0 # home-brewed & dependencies -librarian==2.4.10 +librarian==2.4.12 # celery tasks celery[redis]==5.2.7 diff --git a/src/catalogue/models/tag.py b/src/catalogue/models/tag.py index 2ade345a5..1051741bd 100644 --- a/src/catalogue/models/tag.py +++ b/src/catalogue/models/tag.py @@ -159,7 +159,10 @@ class Tag(models.Model): def get_absolute_catalogue_url(self): # TODO: remove magic. - return reverse(f'{self.category}_catalogue') + if self.category == 'set': + return reverse('social_my_shelf') + else: + return reverse(f'{self.category}_catalogue') def has_description(self): return len(self.description) > 0 diff --git a/src/catalogue/templates/catalogue/2022/author_box.html b/src/catalogue/templates/catalogue/2022/author_box.html index 499a2a030..35a3ea05b 100644 --- a/src/catalogue/templates/catalogue/2022/author_box.html +++ b/src/catalogue/templates/catalogue/2022/author_box.html @@ -1,20 +1,32 @@
-

O autorze

+

+ {% if tag.category == 'author' %}O autorze + {% elif tag.category == 'kind' %}O rodzaju + {% elif tag.category == 'genre' %}O gatunku + {% elif tag.category == 'epoch' %}O epoce + {% elif tag.category == 'set' %}Półka + {% endif %} +

- {% if author.photo %} + {% if tag.photo %}
- {{ author.name }} + {{ tag.name }}
- {{ author.photo_attribution|safe }} + {{ tag.photo_attribution|safe }}
{% endif %}
-

{{ author.name }}

+ {% if tag.category == 'set' %} + {% load chunks %} + {% chunk 'polka-how-to' %} + {% else %} +

{{ tag.name }}

- {{ author.description|safe }} + {{ tag.description|safe }}
+ {% endif %}
diff --git a/src/catalogue/templates/catalogue/2022/author_detail.html b/src/catalogue/templates/catalogue/2022/author_detail.html index 716a4b5d5..dc673b26a 100644 --- a/src/catalogue/templates/catalogue/2022/author_detail.html +++ b/src/catalogue/templates/catalogue/2022/author_detail.html @@ -84,7 +84,7 @@ {% if tags %}
- {% with author=tags.0 %} + {% with tag=tags.0 %} {% include 'catalogue/2022/author_box.html' %} {% endwith %} {% choose_cites 3 author=tags.0 as cites %} diff --git a/src/catalogue/templates/catalogue/2022/fragment_box.html b/src/catalogue/templates/catalogue/2022/fragment_box.html index f98d0b5ac..2522ce66e 100644 --- a/src/catalogue/templates/catalogue/2022/fragment_box.html +++ b/src/catalogue/templates/catalogue/2022/fragment_box.html @@ -1,6 +1,10 @@ - {{ fragment.short_text|safe }} + {% if fragment.short_text %} + {{ fragment.short_text|safe }} + {% else %} + {{ fragment.text|safe }} + {% endif %}

{{ fragment.book.pretty_title }}

diff --git a/src/catalogue/views.py b/src/catalogue/views.py index de614ea75..16b66f0fb 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -109,6 +109,13 @@ 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 not (extra and extra.get('theme_is_set')): if fragments is None: if list_type == 'gallery': @@ -126,8 +133,7 @@ def object_list(request, objects, fragments=None, related_tags=None, tags=None, categories = split_tags(*related_tag_lists) suggest = [] - for c in ['author', 'epoch', 'kind', 'genre']: - #if len(categories.get(c, [])) > 1: + for c in ['set', 'author', 'epoch', 'kind', 'genre']: suggest.extend(sorted(categories[c], key=lambda t: -t.count)[:3]) objects = list(objects) @@ -155,14 +161,11 @@ def object_list(request, objects, fragments=None, related_tags=None, tags=None, if extra: result.update(extra) - is_set = any((x.category == 'set' for x in tags)) is_theme = len(tags) == 1 and tags[0].category == 'theme' has_theme = any((x.category == 'theme' for x in tags)) new_layout = request.EXPERIMENTS['layout'] - if is_set and new_layout.value: - template = 'social/2022/set_detail.html' - elif is_theme and new_layout.value: + if is_theme and new_layout.value: template = 'catalogue/2022/theme_detail.html' elif new_layout.value and not has_theme: template = 'catalogue/2022/author_detail.html' diff --git a/src/club/migrations/0043_monthlyamount_wide_singleamount_wide.py b/src/club/migrations/0043_monthlyamount_wide_singleamount_wide.py new file mode 100644 index 000000000..0c696b280 --- /dev/null +++ b/src/club/migrations/0043_monthlyamount_wide_singleamount_wide.py @@ -0,0 +1,34 @@ +# Generated by Django 4.0.8 on 2023-05-08 12:46 + +from django.db import migrations, models + + +def last_amount_wide(apps, schema_editor): + SingleAmount = apps.get_model('club', 'SingleAmount') + a = SingleAmount.objects.last() + a.wide = True + a.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('club', '0042_auto_20220826_1458'), + ] + + operations = [ + migrations.AddField( + model_name='monthlyamount', + name='wide', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='singleamount', + name='wide', + field=models.BooleanField(default=False), + ), + migrations.RunPython( + last_amount_wide, + migrations.RunPython.noop + ) + ] diff --git a/src/club/models.py b/src/club/models.py index 5912b8b6f..8338b554b 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -37,11 +37,39 @@ class Club(models.Model): def __str__(self): return 'Klub' + def get_amounts(self): + c = {} + single = list(self.singleamount_set.all()) + monthly = list(self.monthlyamount_set.all()) + 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: + wide_spot += 2 + else: + wide_spot += 1 + wide_spot %= 3 + c[tag] = amounts + c[f'{tag}_wide_spot'] = wide_spot + return c + + class SingleAmount(models.Model): club = models.ForeignKey(Club, models.CASCADE) amount = models.IntegerField() description = models.TextField(blank=True) + wide = models.BooleanField(default=False) class Meta: ordering = ['amount'] @@ -50,6 +78,7 @@ class MonthlyAmount(models.Model): club = models.ForeignKey(Club, models.CASCADE) amount = models.IntegerField() description = models.TextField(blank=True) + wide = models.BooleanField(default=False) class Meta: ordering = ['amount'] diff --git a/src/club/templates/club/2022/donation_step1_form.html b/src/club/templates/club/2022/donation_step1_form.html index bd4582645..2f9886959 100644 --- a/src/club/templates/club/2022/donation_step1_form.html +++ b/src/club/templates/club/2022/donation_step1_form.html @@ -17,9 +17,10 @@
+ {% with amounts=club.get_amounts %}
- {% for amount in club.singleamount_set.all %} -
+ {% for amount in amounts.single %} +

{{ amount.amount }} zł

@@ -41,8 +42,8 @@
- {% for amount in club.monthlyamount_set.all %} -
+ {% for amount in amounts.monthly %} +

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

{{ amount.description|safe }}

@@ -63,9 +64,15 @@
+ {% endwith %} -Bezpieczne płatności zapewniają +
+ +Bezpieczne płatności zapewniają: + +
+
diff --git a/src/search/views.py b/src/search/views.py index e5eb3a274..5acbffa85 100644 --- a/src/search/views.py +++ b/src/search/views.py @@ -90,14 +90,14 @@ def hint(request, mozhint=False, param='term'): translator = b.translator() if translator: author_str += ' (tłum. ' + translator + ')' - data.append( - { - 'label': b.title, - 'author': author_str, - 'id': b.id, - 'url': b.get_absolute_url() - } - ) + data.append( + { + 'label': b.title, + 'author': author_str, + 'id': b.id, + 'url': b.get_absolute_url() + } + ) if mozhint: data = [ diff --git a/src/wolnelektury/settings/apps.py b/src/wolnelektury/settings/apps.py index 7410808cd..fe42e04c1 100644 --- a/src/wolnelektury/settings/apps.py +++ b/src/wolnelektury/settings/apps.py @@ -55,7 +55,6 @@ INSTALLED_APPS_CONTRIB = [ 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.staticfiles', - 'admin_auto_filters', 'admin_ordering', 'rest_framework', 'fnp_django_pagination', diff --git a/src/wolnelektury/settings/contrib.py b/src/wolnelektury/settings/contrib.py index bf0cbcf76..f2247facd 100644 --- a/src/wolnelektury/settings/contrib.py +++ b/src/wolnelektury/settings/contrib.py @@ -52,3 +52,4 @@ FORMS_BUILDER_EXTRA_FIELDS = [ ] FORMS_BUILDER_HELPTEXT_MAX_LENGTH = 2048 FORMS_BUILDER_REQUIRED_CSS_CLASS = 'required' +FORMS_BUILDER_INACTIVE_VISIBLE = True diff --git a/src/wolnelektury/static/2022/images/payments-2.png b/src/wolnelektury/static/2022/images/payments-2.png new file mode 100644 index 000000000..346076122 Binary files /dev/null and b/src/wolnelektury/static/2022/images/payments-2.png differ diff --git a/src/wolnelektury/static/2022/images/payments-padlock.png b/src/wolnelektury/static/2022/images/payments-padlock.png new file mode 100644 index 000000000..094335dd1 Binary files /dev/null and b/src/wolnelektury/static/2022/images/payments-padlock.png differ diff --git a/src/wolnelektury/static/2022/more.scss b/src/wolnelektury/static/2022/more.scss index 7bdd83315..7505aab5b 100644 --- a/src/wolnelektury/static/2022/more.scss +++ b/src/wolnelektury/static/2022/more.scss @@ -5,15 +5,6 @@ body.is-open { overflow-y: hidden; } -.l-change-pop { - margin-top: 18px; -} -.is-open .l-change-pop { - height: auto; - margin-top: 18px; - padding: 10px 50px; -} - .l-navigation__logo { height: 44px; } @@ -51,7 +42,7 @@ body.is-open { .l-books__item { @include rwd($break-wide) { - width: 214.5px; + width: 214.4px; margin-left: 17px; margin-right: 0; &:first-of-type { @@ -284,12 +275,6 @@ form { overflow: hidden; } - -.l-change-pop { - margin-bottom: 18px; -} - - .poll-bar { height: 10px; width: 100%; diff --git a/src/wolnelektury/static/2022/styles/layout/_article.scss b/src/wolnelektury/static/2022/styles/layout/_article.scss index 9930b5917..8655babc0 100644 --- a/src/wolnelektury/static/2022/styles/layout/_article.scss +++ b/src/wolnelektury/static/2022/styles/layout/_article.scss @@ -64,19 +64,18 @@ } .l-article__cols { - display: flex; - - .left-column { - padding-right: 27px; - } - - .right-column { - padding-left: 27px; - } + @include rwd($break-flow) { + display: flex; + gap: 22px; + } .left-column, .right-column { - width: 50%; + padding: 0 16px; + + @include rwd($break-flow) { + width: 50%; + } p { margin-top: 0; @@ -162,6 +161,8 @@ margin-bottom: 38px; padding-bottom: 20px; border-bottom: 1px solid #D9D9D9; + margin-left: 16px; + margin-right: 16px; * { margin-top: 0; font-weight: $regular; diff --git a/src/wolnelektury/static/2022/styles/layout/_checkout.scss b/src/wolnelektury/static/2022/styles/layout/_checkout.scss index 26203f5d7..b4423dda4 100644 --- a/src/wolnelektury/static/2022/styles/layout/_checkout.scss +++ b/src/wolnelektury/static/2022/styles/layout/_checkout.scss @@ -1,6 +1,9 @@ //Support bar .l-checkout__support { - margin-bottom: 22px; + margin-bottom: 22px; + + margin-left: 16px; + margin-right: 16px; } .l-checkout__support__bar { @@ -49,11 +52,19 @@ border-radius: 10px; padding-bottom: 30px; overflow: hidden; + margin: 0 16px; } .l-checkout__box__header { display: flex; background: #083F4D; + + img { + display: none; + @include rwd($break-flow) { + display: block; + } + } } .l-checkout__box__header__content h1 { @@ -92,9 +103,13 @@ //Steps .l-checkout__steps { display: flex; - padding: 0 125px; - justify-content: space-between; margin-top: -24px; + justify-content: space-around; + + @include rwd($break-flow) { + padding: 0 125px; + justify-content: space-between; + } div { width: 145px; @@ -126,6 +141,10 @@ text-align: center; letter-spacing: -0.01em; color: #083F4D; + display: none; + @include rwd($break-flow) { + display: block; + } } &.is-completed { @@ -232,39 +251,40 @@ //Payments .l-checkout__payments { display: none; - padding: 0 30px; + padding: 0 16px; margin-top: 34px; margin-bottom: 0; flex-wrap: wrap; justify-content: flex-start; - flex-direction: column; + flex-direction: row; + column-gap: 16px; @include rwd($break-flow) { - flex-direction: row; + //flex-direction: row; + padding: 0 30px; + column-gap: 30px; } } .l-checkout__payments__box { display: flex; flex-direction: column; - width: calc(33.333% - 20px); background: #FFFFFF; border-radius: 10px; overflow: hidden; transition: box-shadow $ease-out 250ms; box-shadow: 0px 0px 0px rgba(55, 170, 156, 0); margin-bottom: 30px; - margin-right: 30px; + width: calc(50% - 8px); - &:nth-child(3) { - margin-right: 0; + &.narrow-wide { + flex-direction: row; + width: 100%; } - - &:nth-child(5) { - margin-right: 0; - width: calc(67.4% - 20px); + + @include rwd($break-flow) { + width: calc(33.333% - 20px); } - h3 { margin: 0; font-weight: bold; @@ -289,9 +309,12 @@ } } .l-checkout__payments__box__btn-wrp { - padding: 20px; + padding: 0 20px 20px 20px; margin-bottom: 0; margin-top: auto; + @include rwd($break-flow) { + padding-top: 20px; + } } p { margin-top: 0; @@ -313,8 +336,8 @@ outline: 0; cursor: pointer; font-weight: 600; - font-size: 20px; - line-height: 25px; + font-size: 16px; + line-height: 24px; display: flex; align-items: center; justify-content: center; @@ -322,14 +345,25 @@ color: #083F4D; transition: background $ease-out 250ms; + @include rwd($break-flow) { + font-size: 20px; + line-height: 25px; + } + &:hover { background: rgba(#92BD39, 0.75); } } &.is-active { - box-shadow: 0px 0px 20px rgba(55, 170, 156, 0.35); + box-shadow: 0px 0px 20px rgba(55, 170, 156, 0.35); + background: #083F4D; + color: white; + @include rwd($break-flow) { + background: white; + color: black; + } h3 { color: white; background: #083F4D; @@ -344,23 +378,28 @@ } &.l-checkout__payments__box--xl { - flex-direction: row; - & > div { - display: flex; - &:first-child { - width: 50%; - flex-wrap: wrap; - max-width: 340px; - margin-right: 20px; + width: 100%; + @include rwd($break-flow) { + width: calc(67.4% - 20px); + width: calc(67.4% - 20px); + flex-direction: row; + & > div { + display: flex; + &:first-child { + width: 50%; + flex-wrap: wrap; + max-width: 340px; + margin-right: 20px; + } + + &:last-child { + width: 49%; + align-items: center; + justify-content: center; + } + } } - &:last-child { - width: 49%; - align-items: center; - justify-content: center; - } - } - h3 { width: 100%; } @@ -369,6 +408,14 @@ width: 100%; } + &.once { + h3 { + text-indent: 0; + padding-left: 0; + } + } + } + &.l-checkout__payments__box--special { button { border-color: #FFA500; background-color: #FFA500; @@ -376,23 +423,23 @@ background: darken(#FFA500, 5%); } } - - &.once { - h3 { - text-indent: 0; - padding-left: 0; - } - } } } //Amount .l-checkout__amount { display: flex; - align-items: flex-end; - justify-content: flex-end; - padding-right: 30px; + flex-direction: column; + padding: 0 16px; + row-gap: 16px; + @include rwd($break-flow) { + flex-direction: row; + align-items: flex-end; + justify-content: flex-end; + padding-right: 30px; + } + button { border: none; height: 56px; @@ -405,13 +452,19 @@ align-items: center; justify-content: center; text-align: center; - margin-left: 32px; color: #FFFFFF; - width: 340px; + + @include rwd($break-flow) { + margin-left: 32px; + width: 340px; + } + } .l-checkout__input { - width: 340px; + @include rwd($break-flow) { + width: 340px; + } } } @@ -462,9 +515,15 @@ //Cols .l-checkout__cols { display: flex; - padding: 0 30px; + flex-direction: column; margin-top: 50px; + padding: 0 16px; + @include rwd($break-flow) { + padding: 0 30px; + flex-direction: row; + } + &.bt-w { margin-top: 30px; padding-top: 20px; @@ -473,6 +532,7 @@ } .l-checkout__col { + @include rwd($break-flow) { &:nth-child(1) { width: 402px; padding-right: 62px; @@ -500,15 +560,28 @@ } } } + } } -.l-checkout__footer__img { - display: flex; - margin-right: 30px; - margin-left: auto; - margin-top: 30px; +.l-checkout__secure { + margin-top: 30px; + margin-right: 30px; + text-align: right; + font-size: 15px; + color: #888; + + .l-checkout__secure__padlock { + margin-right: 5px; + vertical-align: baseline; + } + + .l-checkout__secure__img { + margin-left: 10px; + vertical-align: bottom; + } } + //Form .l-checkout__form { display: flex; @@ -709,6 +782,8 @@ flex-wrap: wrap; margin-top: 12px; margin-bottom: 52px; + margin-left: 16px; + margin-right: 16px; } .l-checkout__footer > img { @@ -723,7 +798,12 @@ .l-checkout__footer__content__item { display: flex; + flex-direction: column; + @include rwd($break-flow) { + flex-direction: row; + } + &:not(:last-child) { padding-bottom: 30px; margin-bottom: 30px; @@ -732,17 +812,21 @@ } .l-checkout__footer__content h3 { + @include rwd($break-flow) { font-weight: 600; font-size: 21.5px; line-height: 140%; letter-spacing: -0.01em; color: #083F4D; width: 318px; + } } .l-checkout__footer__content__item > div { + @include rwd($break-flow) { width: 100%; padding-left: 120px; + } } .l-checkout__footer__content__item > div p { @@ -831,3 +915,18 @@ } } } + + +.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; + } + } +} diff --git a/src/wolnelektury/static/2022/styles/layout/_navigation.scss b/src/wolnelektury/static/2022/styles/layout/_navigation.scss index e7f551ddd..04e4dff1f 100644 --- a/src/wolnelektury/static/2022/styles/layout/_navigation.scss +++ b/src/wolnelektury/static/2022/styles/layout/_navigation.scss @@ -148,12 +148,23 @@ body { max-width: 1140px; border-radius: 10px; padding: 10px 50px; - width: 100%; - margin-bottom: 10px; + width: auto; + + margin-top: 18px; + margin-bottom: 18px; background-color: #FBC40F; position: relative; display: none; + margin-left: 16px; + margin-right: 16px; + flex-direction: column; + column-gap: 48px; + + @include rwd($break-flow) { + flex-direction: row; + } + &.show { display: flex; } @@ -165,9 +176,8 @@ body { line-height: 100%; letter-spacing: -0.02em; color: #333333; - margin: 0; + margin: 20px 0; min-width: 189px; - margin-right: 48px; } p { diff --git a/src/wolnelektury/static/2022/styles/local.scss b/src/wolnelektury/static/2022/styles/local.scss index 548c0b14a..982350906 100644 --- a/src/wolnelektury/static/2022/styles/local.scss +++ b/src/wolnelektury/static/2022/styles/local.scss @@ -4,26 +4,6 @@ $green: #92BD39; $red: #FF4C54; -.l-change-pop { - transition: 350ms all; - - p { - a { - color: $teal; - } - } -} - - -.is-open .l-change-pop { - height: 0; - margin-top: 0; - margin-bottom: 0; - padding-top: 0; - padding-bottom: 0; -} - - .ui-autocomplete a { display: block; transition: none; @@ -207,6 +187,7 @@ $red: #FF4C54; padding: 5px 10px; margin-left: 5px; border-radius: 15px; + white-space: nowrap; a { color: currentColor; diff --git a/src/wolnelektury/templates/2022/base.html b/src/wolnelektury/templates/2022/base.html index 5c65e0362..ca76cd90a 100644 --- a/src/wolnelektury/templates/2022/base.html +++ b/src/wolnelektury/templates/2022/base.html @@ -33,18 +33,6 @@
{% endif %} -
-

Przekaż 1,5%

-

- Przekaż 1,5% podatku na Wolne Lektury KRS 00000 70056
- Ufunduj darmowe książki dla tysięcy dzieciaków.
- WIĘCEJ -

- -
- {% block global-content %}