From 150c16b9cecccacdbf17360d334fc618172f4179 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 3 Nov 2022 14:26:13 +0100 Subject: [PATCH 1/1] Funding view --- src/funding/locale/pl/LC_MESSAGES/django.mo | Bin 13409 -> 13288 bytes src/funding/locale/pl/LC_MESSAGES/django.po | 12 ++- src/funding/models.py | 20 ++++ .../funding/2022/includes/funding.html | 42 ++++++++ .../templates/funding/2022/offer_detail.html | 99 ++++++++++++++++++ src/funding/templatetags/funding_tags.py | 5 + src/funding/views.py | 7 +- src/wolnelektury/settings/static.py | 7 ++ src/wolnelektury/static/2021/scripts/main.js | 2 +- src/wolnelektury/static/2022/more.scss | 53 ++++++++++ .../static/2022/styles/local.scss | 18 ++++ src/wolnelektury/templates/2022/base.html | 36 +++++-- .../templates/2022/main_page.html | 2 + 13 files changed, 285 insertions(+), 18 deletions(-) create mode 100644 src/funding/templates/funding/2022/includes/funding.html create mode 100644 src/funding/templates/funding/2022/offer_detail.html diff --git a/src/funding/locale/pl/LC_MESSAGES/django.mo b/src/funding/locale/pl/LC_MESSAGES/django.mo index 99760e1bb8be895fa95a57754545047ec5608a84..2f5ef468dc43ec9e8fd619c28ca0843cbbb068e5 100644 GIT binary patch delta 2434 zcmXxke@xVM9LMqZ0m2=Epd>1EaD;#ghj$)ML7lLHsdR$ik2F(I6cABT)bx*TY0OzJ zm*326Ys;{v%~r{B)inQ*{wSBxR&%jg>fEHc>JOE*xwW1z@9TH>zQ^bDz3=z)^ZmJ7 z9V6|r-zOv;H?FYYOdeK<3gE-suYfPrTAkEB&wYU+N zVGVwPYU)1b;3FJ|+399u%wkqVfsd8)m4%gqRF%Q*n6&B(Gtj1Q< z%s<2+oF0wMYS`En$RPpX&XNt>E8+{?8Gq6!_)W_-o#3Lh?@D#31*XU5qfbw zYT)h2$9D3y1p80}{t5N_J&fWg7GN#Qv>3NwY%Yb*D3sv{zK0X(eF}b#?f3)waTdcb z!bU8|J*YkY2(`C&Q7f3hXypvtfK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`$;U>l#SIvLh{9c%~*=tQEPk*wYIlW8O&mxWCbqA7S!_}qQ<*|H8^Yt`B%!8^IDzwGPdKt*o>_# zpo3>I85c9Fx!8p2=rB&iUvLfPFpHJ=B5G6q>3SEnMEyt$`_=r&=Ch$WG%w);~j4ME>yq!kZoXZqMkc~y6?TXTR4T< zG#|M)eCf7dKn-vSx8YB2dk1H=nR*O0p)XLGxQfcqQ1Y#TqPUym8^ht4l$Y2mBLZfx z@qN6E!WIf2qh?f_pBQis#;7mAD(rLH`*So3sHY+O)5=h9Snby9k^N>%Q4{DymfO~& z?%RQ5@KvOrxSgP&<8T?7q}@PX!u))zr6@vm5W;t{79;o{&ceuO(vQ8UOpK>@idKc? z*ouX?*KI$I$<(i6k_FYH7HjYY9EqQ!_Qr3hwfzSf(`FSV zj^8@$pneqfT<&q3c5dBF8;RHhE0HrG+~;BnV8m`?o@)O{CRzehjyYsdkxKTw&?DkuK~D1_K4x?w7+ zgBj?>d9F*`?^{tB=t2#!)BS!gYC;Ea5WeNskD-tH2^@%hxE0T%CcZGppU64o zWeraxDi**9F_=)&3y3JuLg-@A?``jP>>|bz+I?#YcILhR3L2bKzKKcA&MjZIubZ}I z#ERbZ)cSPi;$VMfv^}t?vpdk$9bO%6-xO%??43EJ*pm?|2~H^q1p}c;6~QUR!E$Fy z?tJHJ?!~*;-SXHU5AdFR4}zk9cqw0r&sW3d\n" "Language-Team: \n" "Language: pl\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" -"X-Generator: Poedit 2.4.1\n" +"X-Generator: Poedit 3.0.1\n" #: funding/admin.py:27 msgid "payment complete" @@ -434,8 +434,8 @@ msgid "" "We need %(target)s zł to digitize it,\n" " compile it and publish for free in multiple formats." msgstr "" -"Potrzebujemy %(target)s zł, by ją zdigitalizować, opracować i bezpłatnie " -"udostępnić w serwisie w wielu formatach." +"Potrzebujemy %(target)s zł, by zdigitalizować tę książkę, opracować i " +"bezpłatnie udostępnić w serwisie w wielu formatach." #: funding/templates/funding/includes/offer_status.html:17 #, python-format @@ -602,10 +602,12 @@ msgid "" " from successful fundraisers.\n" " " msgstr "" +"\n" "Jeśli nie udało się zebrać pełnej kwoty potrzebnej do opublikowania książki, " "środki przekazujemy na redakcję innych utworów " "oczekujących na publikację w serwisie. Na ten cel przekazujemy również " -"nadmiarowe środki ze zbiórek ukończonych sukcesem." +"nadmiarowe środki ze zbiórek ukończonych sukcesem.\n" +" " #: funding/templates/funding/wlfund.html:21 msgid "Spending these remaining funds is recorded in this table." diff --git a/src/funding/models.py b/src/funding/models.py index 838d2ab35..7d0e74247 100644 --- a/src/funding/models.py +++ b/src/funding/models.py @@ -69,8 +69,10 @@ class Offer(models.Model): def clear_cache(self): clear_cached_renders(self.top_bar) + clear_cached_renders(self.top_bar_2022) clear_cached_renders(self.list_bar) clear_cached_renders(self.detail_bar) + clear_cached_renders(self.detail_bar_2022) clear_cached_renders(self.status) clear_cached_renders(self.status_more) @@ -243,6 +245,24 @@ class Offer(models.Model): def status_more(self): return {'offer': self} + @cached_render('funding/2022/includes/funding.html') + def top_bar_2022(self): + ctx = self.basic_info() + ctx.update({ + 'link': True, + 'closeable': True, + 'add_class': 'funding-top-header', + }) + return ctx + + @cached_render('funding/2022/includes/funding.html') + def detail_bar_2022(self): + ctx = self.basic_info() + ctx.update({ + 'show_title': False, + }) + return ctx + class Perk(models.Model): """ A perk offer. diff --git a/src/funding/templates/funding/2022/includes/funding.html b/src/funding/templates/funding/2022/includes/funding.html new file mode 100644 index 000000000..f80a07547 --- /dev/null +++ b/src/funding/templates/funding/2022/includes/funding.html @@ -0,0 +1,42 @@ +{% load i18n %} +{% load time_tags %} + +{% if offer %} + + + + +{% endif %} diff --git a/src/funding/templates/funding/2022/offer_detail.html b/src/funding/templates/funding/2022/offer_detail.html new file mode 100644 index 000000000..b6d89e6d1 --- /dev/null +++ b/src/funding/templates/funding/2022/offer_detail.html @@ -0,0 +1,99 @@ +{% extends '2022/base.html' %} +{% load i18n %} +{% load chunks %} +{% load thumbnail %} +{% load fundings from funding_tags %} + + +{% block settings %} + {% load title %} + {% title object %} +{% endblock %} + + +{% block breadcrumbs %} + Zbiórki + {{ object }} +{% endblock %} + + +{% block main %} + {{ object.detail_bar_2022 }} + +
+

{{ object }}

+ +
+
+
+ {% if object.cover %} + {% thumbnail object.cover '320x1000' as th %} + + {% endthumbnail %} + {% endif %} +
+
+
+
+ {{ object.description|safe }} +
+ {% if object.is_current %} +
+ {{ form.as_p }} + + {{ form.data_processing }} + + +
+ {% else %} + {{ object.status }} + {{ object.status_more }} + {% endif %} +
+
+ +
+ + + + +
+

{% trans "Supporters" %}

+ {% fundings object %} +
+ + {# pomóż uwolnić #} + {# 1% #} + {# share? #} + + +{% endblock %} diff --git a/src/funding/templatetags/funding_tags.py b/src/funding/templatetags/funding_tags.py index bfd0e5462..3e4889200 100644 --- a/src/funding/templatetags/funding_tags.py +++ b/src/funding/templatetags/funding_tags.py @@ -16,6 +16,11 @@ def funding_top_bar(): offer = Offer.current() return offer.top_bar() if offer is not None else '' +@register.simple_tag +def funding_top_bar_2022(): + offer = Offer.current() + return offer.top_bar_2022() if offer is not None else '' + @register.simple_tag(takes_context=True) def fundings(context, offer): diff --git a/src/funding/views.py b/src/funding/views.py index 71373ae26..d34eccc00 100644 --- a/src/funding/views.py +++ b/src/funding/views.py @@ -71,7 +71,12 @@ class WLFundView(TemplateView): class OfferDetailView(FormView): form_class = FundingForm - template_name = "funding/offer_detail.html" + + def get_template_names(self): + if self.request.EXPERIMENTS['layout'].value: + return 'funding/2022/offer_detail.html' + else: + return "funding/offer_detail.html" @csrf_exempt def dispatch(self, request, slug=None): diff --git a/src/wolnelektury/settings/static.py b/src/wolnelektury/settings/static.py index 776b47f7d..9e07efb27 100644 --- a/src/wolnelektury/settings/static.py +++ b/src/wolnelektury/settings/static.py @@ -143,6 +143,13 @@ PIPELINE = { 'js/2022.js', '2022/book/filter.js', 'chunks/edit.js', + + 'js/contrib/jquery.countdown.js', 'js/contrib/jquery.countdown-pl.js', + 'js/contrib/jquery.countdown-de.js', 'js/contrib/jquery.countdown-uk.js', + 'js/contrib/jquery.countdown-es.js', 'js/contrib/jquery.countdown-lt.js', + 'js/contrib/jquery.countdown-ru.js', 'js/contrib/jquery.countdown-fr.js', + 'pdcounter/pdcounter.js', + ], 'output_filename': 'js/2022.min.js' }, diff --git a/src/wolnelektury/static/2021/scripts/main.js b/src/wolnelektury/static/2021/scripts/main.js index 21c76a023..3dd799a25 100644 --- a/src/wolnelektury/static/2021/scripts/main.js +++ b/src/wolnelektury/static/2021/scripts/main.js @@ -155,7 +155,7 @@ $('.js-collections').each(function() { let collectionsSlider = $('.l-books', this); - if ($collectionsSlider.children().length < 2) return; + if (collectionsSlider.children().length < 2) return; let collectionsNextSlide = $('.js-next-slide', this); let collectionsPrevSlide = $('.js-prev-slide', this); diff --git a/src/wolnelektury/static/2022/more.scss b/src/wolnelektury/static/2022/more.scss index 424125394..754578dd5 100644 --- a/src/wolnelektury/static/2022/more.scss +++ b/src/wolnelektury/static/2022/more.scss @@ -324,6 +324,21 @@ form { margin-right: 50px; width: auto; } + + .wlfund { + margin: 0; + width: 90%; + border-collapse: separate; + + tr { + td { + padding: .625rem .3125rem .625rem; + border-top: .625rem solid rgba(255,255,255,0); + border-bottom: 1px solid #083F4D; + text-align: center; + } + } + } } .page-simple, .nice-controls { @@ -402,3 +417,41 @@ form { } } } + + +.funding-promo-bar { + margin: 18px auto; + + .l-checkout__support { + margin: 0; + a { + display: flex; + align-items: start; + + .buttonlike { + margin-right: 10px; + background: #FFA500; + //color: #083F4D; + color: black; + border-radius: 5px; + font-size: 1.125rem; + line-height: 50px; + letter-spacing: -0.01em; + padding: 0 20px; + font-weight: 600; + transition: all cubic-bezier(0.25, 1, 0.5, 1) 350ms; + &:hover { + background: #92BD39; + } + } + .funding-bar-container { + flex-grow: 1; + } + } + } +} + + +.l-change-pop { + margin-bottom: 18px; +} diff --git a/src/wolnelektury/static/2022/styles/local.scss b/src/wolnelektury/static/2022/styles/local.scss index 46626e6f3..d9aafcf2d 100644 --- a/src/wolnelektury/static/2022/styles/local.scss +++ b/src/wolnelektury/static/2022/styles/local.scss @@ -73,3 +73,21 @@ $teal: #007880; } } } + + + + +.l-checkout__support__bar span.little-progress::after { + white-space: nowrap; + justify-content: left; + width: 200px; + right: -210px; + color: #083F4D; +} +.funding-description { + h2 { + margin-top: 0; + font-size: 1.125rem; + line-height: 1.35; + } +} diff --git a/src/wolnelektury/templates/2022/base.html b/src/wolnelektury/templates/2022/base.html index f314f1f85..36b1452fb 100644 --- a/src/wolnelektury/templates/2022/base.html +++ b/src/wolnelektury/templates/2022/base.html @@ -1,6 +1,8 @@ +{% load cache %} {% load pipeline %} {% load static %} +{% load funding_tags %} {% load piwik_tags %} {% load title %} @@ -29,17 +31,13 @@ {% block under-menu %}{% endblock %} -
-

Zmieniamy się!

-

- Jeżeli to czytasz jesteś jedną z osób, której prezentujemy nowy wygląd części stron. - Będziemy bardzo! wdzięczni za Twoją opinię – możesz nam ją przesłać tutaj. - Jeżeli wolisz klasyczny wygląd - wystarczy, że klikniesz tutaj -

- -
+ {% if not funding_no_show_current %} +
+ {% cache 120 funding_top_bar LANGUAGE_CODE %} + {% funding_top_bar_2022 %} + {% endcache %} +
+ {% endif %} {% block global-content %}
@@ -54,11 +52,27 @@ {% endblock %} +
+

Zmieniamy się!

+

+ Jeżeli to czytasz jesteś jedną z osób, której prezentujemy nowy wygląd części stron. + Będziemy bardzo! wdzięczni za Twoją opinię – możesz nam ją przesłać tutaj. + Jeżeli wolisz klasyczny wygląd - wystarczy, że klikniesz tutaj +

+ +
+ + {% include '2022/footer.html' %} + {% javascript '2022' %} {% javascript '2022_player' %} {% block extrabody %}{% endblock %} diff --git a/src/wolnelektury/templates/2022/main_page.html b/src/wolnelektury/templates/2022/main_page.html index 35149f3b6..b541467ad 100644 --- a/src/wolnelektury/templates/2022/main_page.html +++ b/src/wolnelektury/templates/2022/main_page.html @@ -144,10 +144,12 @@

{{ recommended_collection.title }}

+ {% comment %}
+ {% endcomment %}
{% for book in recommended_collection.get_books %} -- 2.20.1