Some minor funding changes.
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 10 Apr 2013 12:26:37 +0000 (14:26 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 10 Apr 2013 12:26:37 +0000 (14:26 +0200)
19 files changed:
apps/funding/static/funding/funding.css
apps/funding/static/funding/funding.scss
apps/funding/templates/funding/offer_detail.html
apps/funding/templates/funding/offer_list.html
apps/funding/templates/funding/tags/funding.html
apps/funding/templates/funding/thanks.html
apps/funding/templatetags/funding_tags.py
apps/funding/urls.py
apps/funding/views.py
apps/lesmianator/templates/lesmianator/lesmianator.html
apps/pdcounter/static/pdcounter/pdcounter.js
apps/pdcounter/templates/pdcounter/author_detail.html
apps/pdcounter/templates/pdcounter/book_stub_detail.html
apps/pdcounter/templatetags/time_tags.py
apps/wolnelektury_core/static/css/base.css
apps/wolnelektury_core/static/css/book_box.css
apps/wolnelektury_core/static/css/catalogue.css
apps/wolnelektury_core/static/css/main_page.css
wolnelektury/settings/__init__.py

index 6c3ef37..5384773 100755 (executable)
@@ -1 +1 @@
-a.funding{font-size:1.5em;padding:.5em 1em;display:block;color:#000;background-image:url(/static/img/green-pixel.png);background-repeat:repeat-y;background-color:rgba(13, 126, 133, .2)}.wlfund{width:100%;border-collapse:collapse}.wlfund td{padding:0 0 1em 0;text-align:center}.wlfund td:last-child{text-align:right}.wlfund td div{padding:1em;box-shadow:0 2px 0 #DDD}.wlfund .funding-plus td div{background:rgba(13, 126, 133, .2)}.wlfund .funding-minus td div{bbackground:rgba(255, 0, 0, .2);background:#fff}.funding-current{margin-bottom:3em}.funding-stale .funding{opacity:.5}
\ No newline at end of file
+a.funding{font-size:1.5em;padding:.5em 1em;display:block;color:#000;background-image:url(/static/img/green-pixel.png);background-repeat:repeat-y;background-color:rgba(13, 126, 133, .2)}a.funding .mono{font-size:.9em}.wlfund{width:100%;border-collapse:collapse}.wlfund td{padding:0 0 1em 0;text-align:center}.wlfund td:last-child{text-align:right}.wlfund td div{padding:1em;box-shadow:0 2px 0 #DDD}.wlfund .funding-plus td div{background:rgba(13, 126, 133, .2)}.wlfund .funding-minus td div{bbackground:rgba(255, 0, 0, .2);background:#fff}.funding-stale .funding{opacity:.5}
\ No newline at end of file
index c5e8c48..435b0ac 100755 (executable)
@@ -7,6 +7,10 @@ a.funding {
     background-image: url(/static/img/green-pixel.png);
     background-repeat: repeat-y;
     background-color: fade-out(#0D7E85, .8);
+
+    .mono {
+        font-size: .9em;
+    }
 }
 
 .wlfund {
@@ -38,9 +42,6 @@ a.funding {
 }
 
 
-.funding-current {
-    margin-bottom: 3em;
-}
 .funding-stale {
     .funding {
         opacity: .5;
index 53c514f..81007b0 100755 (executable)
@@ -36,7 +36,7 @@
 </div>
 
 
-<h2 style="font-size: 3em; margin: 1em 0 .5em;">{% trans "Supporters" %}:</h2>
+<h2>{% trans "Supporters" %}:</h2>
 
 <div class="white-box normal-text">
     
index 44cd828..26f6a47 100755 (executable)
@@ -8,9 +8,13 @@
 {% block body %}
 <h1>{% trans "Support Wolne Lektury" %}</h1>
 
-<ul class="plain">
 {% for funding in object_list %}
-    <li class="white-box funding-{% if funding.is_current %}current{% else %}stale{% endif %}">
+    {% if funding.is_current %}
+        <h2>{% trans "Current fundraiser:" %}</h2>
+    {% elif forloop.is_first %}
+        <h2>{% trans "Previous fundraisers:" %}</h2>
+    {% endif %}
+    <div class="white-box funding-{% if funding.is_current %}current{% else %}stale{% endif %}">
         <p class="normal-text">{{ funding.start }} – {{ funding.end }}
         {% if not funding.is_current %}
             ({% trans "funding closed" %})
         </p>
         {% funding funding link=1 %}
         {% offer_detail_head funding %}
-    </li>
+    </div>
+    {% if funding.is_current and not forloop.is_last %}
+        <h2>{% trans "Previous fundraisers:" %}</h2>
+    {% endif %}
 {% endfor %}
-</ul>
 
 {% endblock %}
index 981ae62..dd25247 100755 (executable)
     {% endif %}
     <em>{{ offer }}</em>
     <span style="float:right">
-    {% trans "collected" %}: <em>{{ offer.sum }} / {{ offer.target }} zł</em>
+    <span style="display:inline-block;margin-right: 1.5em;">{% trans "missing" %}: <em>{{ missing }} zł</em></span>
+    <span style="display:inline-block;margin-right: 1.5em;">{% trans "collected" %}: <em>{{ sum }} </em></span>
     {% if is_current %}
-        <span style="margin-left: 2em;">{% trans "until fundraiser end" %}:
-            <strong class="countdown inline" data-until='{{ offer.end|local_to_utc|utc_for_js }}'></strong>
+        <span style="display:inline-block;margin-right: 0em;">{% trans "until fundraiser end" %}:
+            <strong class="countdown inline mono" data-until='{{ offer.end|date_to_utc:True|utc_for_js }}'></strong>
         </span>
     {% endif %}
     </span>
index 2863c69..f3ca19f 100755 (executable)
@@ -1,6 +1,6 @@
 {% extends "base.html" %}
 {% load i18n %}
-{% load funding_tags %}
+{% load fnp_share %}
 
 {% block titleextra %}{% trans "Thank you!" %}{% endblock %}
 
 
 {% trans "Thank you for your support!" %}
 
-<p><a href="{{ object.get_absolute_url }}">{% trans "Go back to the current fundraiser." %}</a></p>
+
+
+{% url 'funding_current' as current %}
+<p><a href="{{ current }}">{% trans "Go back to the current fundraiser." %}</a></p>
+
+{% url 'funding_current' as current %}
+<p>{% share current 'y' %}</p>
+
 </div>
 
 
index 5331f8c..ae3b04f 100755 (executable)
@@ -4,17 +4,20 @@ from ..models import Offer
 register = template.Library()
 
 
-@register.inclusion_tag("funding/tags/funding.html")
-def funding(offer=None, link=False, add_class=""):
-    if offer is None:
+@register.inclusion_tag("funding/tags/funding.html", takes_context=True)
+def funding(context, offer=None, link=False, add_class=""):
+    if offer is None and context.get('funding_no_show_current') is None:
         offer = Offer.current()
     if offer is None:
         return {}
 
+    offer_sum = offer.sum()
     return {
         'offer': offer,
+        'sum': offer_sum,
         'is_current': offer.is_current(),
-        'percentage': 100 * offer.sum() / offer.target,
+        'missing': offer.target - offer_sum,
+        'percentage': 100 * offer_sum / offer.target,
         'link': link,
         'add_class': add_class,
     }
index dc79f31..7aed8dc 100755 (executable)
@@ -3,14 +3,14 @@
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 from django.conf.urls import patterns, url
-from django.views.generic import ListView, FormView, TemplateView
 
 from .models import Offer
-from .views import WLFundView, OfferDetailView, ThanksView
+from .views import WLFundView, OfferDetailView, ThanksView, OfferListView
 
 
 urlpatterns = patterns('',
-    url(r'^$', ListView.as_view(queryset=Offer.public()), name='funding'),
+    url(r'^$', OfferDetailView.as_view(), name='funding_current'),
+    url(r'^lektura/$', OfferListView.as_view(), name='funding'),
     url(r'^lektura/(?P<slug>[^/]+)/$', OfferDetailView.as_view(), name='funding_offer'),
     url(r'^dziekujemy/$', ThanksView.as_view(), name='funding_thanks'),
     url(r'^fundusz/$', WLFundView.as_view(), name='funding_wlfund'),
index c14cee3..3ea68b5 100644 (file)
@@ -4,8 +4,9 @@
 #
 from django.conf import settings
 from django.core.urlresolvers import reverse
+from django.http import Http404
 from django.shortcuts import redirect, get_object_or_404
-from django.views.generic import TemplateView, FormView, DetailView
+from django.views.generic import TemplateView, FormView, DetailView, ListView
 from .forms import DummyForm
 from .models import Offer, Spent
 
@@ -70,8 +71,13 @@ class OfferDetailView(FormView):
     form_class = DummyForm
     template_name = "funding/offer_detail.html"
 
-    def dispatch(self, request, slug):
-        self.object = get_object_or_404(Offer.public(), slug=slug)
+    def dispatch(self, request, slug=None):
+        if slug:
+            self.object = get_object_or_404(Offer.public(), slug=slug)
+        else:
+            self.object = Offer.current()
+            if self.object is None:
+                raise Http404
         return super(OfferDetailView, self).dispatch(request, slug)
 
     def get_form(self, form_class):
@@ -83,6 +89,8 @@ class OfferDetailView(FormView):
     def get_context_data(self, *args, **kwargs):
         ctx = super(OfferDetailView, self).get_context_data(*args, **kwargs)
         ctx['object'] = self.object
+        if self.object.is_current():
+            ctx['funding_no_show_current'] = True
         return ctx
 
     def form_valid(self, form):
@@ -90,6 +98,15 @@ class OfferDetailView(FormView):
         return redirect(reverse("funding_thanks"))
 
 
+class OfferListView(ListView):
+    queryset = Offer.public()
+
+    def get_context_data(self, *args, **kwargs):
+        ctx = super(OfferListView, self).get_context_data(*args, **kwargs)
+        ctx['funding_no_show_current'] = True
+        return ctx
+
+
 class ThanksView(TemplateView):
     template_name = "funding/thanks.html"
 
index 0148296..cc7decb 100644 (file)
             <p>Przygotowaliśmy kilka propozycji na start – możesz wybrać jedną z nich,
             albo ułożyć sobie własną, niepowtarzalną mieszankę.</p>
         <ul>
-            <li><h2><a href="{% url 'poem_from_book' 'liryki-lozanskie' %}">Adam Mickiewicz, Liryki lozańskie</a></h2></li>
-            <li><h2><a href="{% url 'poem_from_book' 'sonety-krymskie' %}">Adam Mickiewicz, Sonety krymskie</a></h2></li>
-            <li><h2><a href="{% url 'poem_from_book' 'hymny' %}">Jan Kasprowicz, Hymny</a></h2></li>
-            <li><h2><a href="{% url 'poem_from_book' 'bogurodzica' %}">Bogurodzica</a></h2></li>
+            <li><a href="{% url 'poem_from_book' 'liryki-lozanskie' %}">Adam Mickiewicz, Liryki lozańskie</a></li>
+            <li><a href="{% url 'poem_from_book' 'sonety-krymskie' %}">Adam Mickiewicz, Sonety krymskie</a></li>
+            <li><a href="{% url 'poem_from_book' 'hymny' %}">Jan Kasprowicz, Hymny</a></li>
+            <li><a href="{% url 'poem_from_book' 'bogurodzica' %}">Bogurodzica</a></li>
             {% for s in shelves %}
-                <li><h2><a href="{% url 'poem_from_set' s.slug %}">{{ s.name }}</a></h2></li>
+                <li><a href="{% url 'poem_from_set' s.slug %}">{{ s.name }}</a></li>
             {% endfor %}
     
     </div>
index 661fc9e..a1ff537 100755 (executable)
@@ -30,7 +30,7 @@
                 onExpiry: function(){location.reload()}, // TODO: no reload
             };
             if ($this.hasClass('inline')) {
-                options.layout = '{dn} {dl} {hnn}{sep}{mnn}{sep}{snn}';
+                options.layout = '{d<}{dn} {dl} {d>}{hnn}{sep}{mnn}{sep}{snn}';
             }
             
             $this.countdown(options);
index 352b205..7ed5fa7 100644 (file)
@@ -41,7 +41,7 @@
             {% else %}
                 <div>
                     <p>{% trans "This author's works will become part of public domain and will be allowed to be published without restrictions in" %}</p>
-                    <div class='countdown' data-until='{{ pd_counter|local_to_utc|utc_for_js }}'></div>
+                    <div class='countdown' data-until='{{ pd_counter|date_to_utc|utc_for_js }}'></div>
                     <p>{% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this author's works." %}</p>
                 </div>
             {% endif %}
index 03ba8fa..af91fcb 100644 (file)
@@ -18,7 +18,7 @@
        {% else %}
            {% if book.pd %}
                        <p>{% trans "This work will become part of public domain and will be allowed to be published without restrictions in" %}</p>
-            <div class='countdown' data-until='{{ pd_counter|local_to_utc|utc_for_js }}'></div>
+            <div class='countdown' data-until='{{ pd_counter|date_to_utc|utc_for_js }}'></div>
                        <p>{% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this work." %}</p>
                {% else %}
                    <p>{% trans "This work is copyrighted." %}
index 1d4f23a..e454acd 100755 (executable)
@@ -8,9 +8,15 @@ from django.utils import timezone
 register = template.Library()
 
 @register.filter
-def local_to_utc(localtime):
-    if isinstance(localtime, datetime.date):
-        localtime = datetime.datetime.combine(localtime, datetime.time(0,0))
+def date_to_utc(date, day_end=False):
+    """ Converts a datetime.date to UTC datetime.
+
+    The datetime represents the start (or end) of the given day in
+    the server's timezone.
+    """
+    if day_end:
+        date += datetime.timedelta(1)
+    localtime = datetime.datetime.combine(date, datetime.time(0,0))
     return timezone.utc.normalize(
         pytz.timezone(settings.TIME_ZONE).localize(localtime)
     )
index 5c29ef0..3496937 100755 (executable)
@@ -58,11 +58,19 @@ ul.plain {
 }
 
 h2 {
+    font-size: 2em;
+    font-weight: normal;
+}
+
+h2.plain {
     margin: 0;
     font-size: 1em;
-    font-weight: normal;
 }
 
+h3 {
+    font-size: 1.5em;
+    font-weight: normal;
+}
 
 .mono {
     font-family: "Andale Mono", "Lucida Sans Typewriter", "Courier New";
index 74b710a..190ddd7 100755 (executable)
@@ -286,6 +286,11 @@ ul.inline-items li {
 .book-wide-box .other-download ul {
        font-size: 1.1em;
 }
+.book-wide-box .other-tools h2,
+.book-wide-box .other-download h2 {
+    margin: 0;
+}
+
 
 
 .book-wide-box .license-icon {
index 0e952ba..5f52f24 100755 (executable)
     list-style: none;
 }
 
+#book-a-list #book-list h2 {
+    font-size: 1em;
+    margin: 0;
+}
+
 #book-a-list #book-list h2 a {
     color: black;
 }
@@ -66,6 +71,7 @@
 
 .catalogue-catalogue h2 {
     font-size: 2em;
+    margin: 0;
 }
 .catalogue-catalogue ul {
     column-width: 30em;
 }
 .see-also h2, .download h2 {
     font-size: 1.1em;
+    margin: 0;
 }
 .see-also ul, .download ul {
     list-style: none;
index 3db1655..a53b9de 100755 (executable)
@@ -10,6 +10,7 @@
 }
 #promo-box-header h2 {
     font-size: 1.3em;
+    margin: 0;
 }
 #promo-box-body {
     border-bottom: 2px solid #efefef;
@@ -45,6 +46,8 @@
     padding-top: 1.9em;
     height: 3.2em;
     padding-left: 1.9em;
+    margin: 0;
+    font-size: 1em;
 }
 .main-last span {
     font-size: 1.1em;
@@ -63,6 +66,8 @@
     color: #017e85;
     height: 2.8em;
     padding-top: 2.5em;
+    font-size: 1em;
+    margin: 0;
 }
 .infopages-box h2 span {
     font-size: 1.1em;
index 1c743e5..7b1641c 100644 (file)
@@ -90,6 +90,7 @@ INSTALLED_APPS_CONTRIB = [
     'djkombu',
     'honeypot',
     #'django_nose',
+    'fnpdjango',
 
     #allauth stuff
     'uni_form',