Funding view
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 3 Nov 2022 13:26:13 +0000 (14:26 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 3 Nov 2022 13:26:13 +0000 (14:26 +0100)
13 files changed:
src/funding/locale/pl/LC_MESSAGES/django.mo
src/funding/locale/pl/LC_MESSAGES/django.po
src/funding/models.py
src/funding/templates/funding/2022/includes/funding.html [new file with mode: 0644]
src/funding/templates/funding/2022/offer_detail.html [new file with mode: 0644]
src/funding/templatetags/funding_tags.py
src/funding/views.py
src/wolnelektury/settings/static.py
src/wolnelektury/static/2021/scripts/main.js
src/wolnelektury/static/2022/more.scss
src/wolnelektury/static/2022/styles/local.scss
src/wolnelektury/templates/2022/base.html
src/wolnelektury/templates/2022/main_page.html

index 99760e1..2f5ef46 100644 (file)
Binary files a/src/funding/locale/pl/LC_MESSAGES/django.mo and b/src/funding/locale/pl/LC_MESSAGES/django.mo differ
index 55ec93d..f7107ce 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2021-06-10 14:06+0200\n"
+"PO-Revision-Date: 2022-10-31 13:47+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\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ę <a href=\"%(r)s\">innych utworów "
 "oczekujących na publikację w serwisie</a>. 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."
index 838d2ab..7d0e742 100644 (file)
@@ -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 (file)
index 0000000..f80a075
--- /dev/null
@@ -0,0 +1,42 @@
+{% load i18n %}
+{% load time_tags %}
+
+{% if offer %}
+
+
+  <div class="l-checkout__support">
+    {% if link %}
+      <a href="{% url 'funding_current' offer.slug %}">
+        <span class="buttonlike">Wesprzyj!</span>
+        <div class="funding-bar-container">
+    {% endif %}
+    <div class="l-checkout__support__bar">
+      <span class="{% if percentage < 12 %}little-progress{% endif %}" data-label="{% if sum %}{% trans "collected" %}: {{ sum }} zł{% endif %}" style="width: {{ percentage|stringformat:'.2f' }}%;"></span>
+    </div>
+    <div class="l-checkout__support__footer">
+      {% if show_title %}
+        <p>
+          {% if show_title_calling %}
+            <strong style="margin-right: .6em;">{% trans "Help free the book!" %}</strong>
+          {% endif %}
+          {{ offer }}
+      {% endif %}
+      {% if is_current %}
+        <p>
+          {% trans "until fundraiser end" %}:
+          <strong class="countdown inline" data-until='{{ offer.end|date_to_utc:True|utc_for_js }}'></strong>
+        </p>
+      {% endif %}
+      {% if not is_win %}
+        <p>
+          {% trans "needed" %}: <strong>{{ offer.target }} zł</strong>
+        </p>
+      {% endif %}
+    </div>
+    {% if link %}
+        </div>
+      </a>
+    {% endif %}
+  </div>
+
+{% 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 (file)
index 0000000..b6d89e6
--- /dev/null
@@ -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 %}
+  <a href=""><span>Zbiórki</span></a>
+  <span>{{ object }}</span>
+{% endblock %}
+
+
+{% block main %}
+  {{ object.detail_bar_2022 }}
+
+  <div class="page-simple">
+    <h1>{{ object }}</h1>
+
+    <div class="l-checkout__cols" style="margin-top: 0">
+      <div class="l-checkout__col" >
+        <div class="l-checkout__payments__box is-active">
+          {% if object.cover %}
+            {% thumbnail object.cover '320x1000' as th %}
+            <img src="{{ th.url }}">
+            {% endthumbnail %}
+          {% endif %}
+        </div>
+      </div>
+      <div class="l-checkout__col">
+        <div class="funding-description">
+          {{ object.description|safe }}
+        </div>
+        {% if object.is_current %}
+          <form method="post" style="margin: auto;">
+            {{ form.as_p }}
+            <span class="helptext">
+              {{ form.data_processing }}
+            </span>
+            <button type="submit">{% trans 'Donate!' %}</button>
+          </form>
+        {% else %}
+          {{ object.status }}
+          {{ object.status_more }}
+        {% endif %}
+      </div>
+    </div>
+
+  </div>
+
+
+  <div class="l-checkout__footer">
+    <div class="l-checkout__footer__content">
+
+      {% if object.is_current %}
+        <div class="l-checkout__footer__content__item">
+          <h3>Zasady</h3>
+          <div>
+            <div class="l-article__overlay" data-max-height="91">
+              {{ object.status }}
+              {{ object.status_more }}
+            </div>
+            <button class="l-article__read-more" aria-label="Kliknij aby rozwinąć" data-label="Więcej" data-action="Mniej">Więcej</button>
+          </div>
+        </div>
+
+        <div class="l-checkout__footer__content__item">
+          <h3>Wpłaty bezpośrednie</h3>
+          <div>
+            <div class="l-article__overlay" data-max-height="91">
+              <p>
+                {% chunk 'funding_form_bottom' %}
+              </p>
+            </div>
+            <button class="l-article__read-more" aria-label="Kliknij aby rozwinąć" data-label="Więcej" data-action="Mniej">Więcej</button>
+          </div>
+        </div>
+      {% endif %}
+
+    </div>
+  </div>
+
+  <article class="page-simple">
+    <h1>{% trans "Supporters" %}</h1>
+    {% fundings object %}
+  </article>
+
+  {# pomóż uwolnić #}
+  {# 1% #}
+  {# share? #}
+
+
+{% endblock %}
index bfd0e54..3e48892 100644 (file)
@@ -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):
index 71373ae..d34eccc 100644 (file)
@@ -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):
index 776b47f..9e07efb 100644 (file)
@@ -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'
         },
index 21c76a0..3dd799a 100644 (file)
 
     $('.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);
 
index 4241253..754578d 100644 (file)
@@ -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;
+}
index 46626e6..d9aafcf 100644 (file)
@@ -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;
+    }
+}
index f314f1f..36b1452 100644 (file)
@@ -1,6 +1,8 @@
 <!doctype html>
+{% load cache %}
 {% load pipeline %}
 {% load static %}
+{% load funding_tags %}
 {% load piwik_tags %}
 {% load title %}
 
 
     {% block under-menu %}{% endblock %}
 
-    <div class="l-container l-change-pop">
-      <h3>Zmieniamy się!</h3>
-      <p>
-        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ę – <a href='/formularz/ux-strona-ksiazki-T1/' target="_blank">możesz nam ją przesłać tutaj</a>.
-        Jeżeli wolisz klasyczny wygląd - wystarczy, że <a class="quit-experiment" href="#">klikniesz tutaj</a>
-      </p>
-      <!-- button class="l-change-pop__close">
-           <i class="icon icon-close"></i>
-           </button -->
-    </div>
+    {% if not funding_no_show_current %}
+      <div class="l-container funding-promo-bar">
+        {% cache 120 funding_top_bar LANGUAGE_CODE %}
+          {% funding_top_bar_2022 %}
+        {% endcache %}
+      </div>
+    {% endif %}
 
     {% block global-content %}
       <div class="l-container">
       </main>
     {% endblock %}
 
+    <div class="l-container l-change-pop">
+      <h3>Zmieniamy się!</h3>
+      <p>
+        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ę – <a href='/formularz/ux-strona-ksiazki-T1/' target="_blank">możesz nam ją przesłać tutaj</a>.
+        Jeżeli wolisz klasyczny wygląd - wystarczy, że <a class="quit-experiment" href="#">klikniesz tutaj</a>
+      </p>
+      <!-- button class="l-change-pop__close">
+           <i class="icon icon-close"></i>
+           </button -->
+    </div>
+
+
     {% include '2022/footer.html' %}
 
     <script src="{% static '2022/scripts/vendor.js' %}"></script>
     <script src="{% static '2021/scripts/main.js' %}"></script>
 
+    <script type="text/javascript">
+      var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}";
+    </script>
     {% javascript '2022' %}
     {% javascript '2022_player' %}
     {% block extrabody %}{% endblock %}
index 35149f3..b541467 100644 (file)
         <div class="l-collections js-collections">
           <div class="l-collections__header">
             <h3>{{ recommended_collection.title }}</h3>
+            {% comment %}
             <div class="l-your-books__header__actions">
               <button class="js-prev-slide"><i class="icon icon-arrow-left"></i></button>
               <button class="js-next-slide"><i class="icon icon-arrow-right"></i></button>
             </div>
+            {% endcomment %}
           </div>
           <div class="l-books">
             {% for book in recommended_collection.get_books %}