From 62d83af2cafb15b3940311cf305a30d489909d95 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 10 Apr 2013 14:26:37 +0200 Subject: [PATCH 1/1] Some minor funding changes. --- apps/funding/static/funding/funding.css | 2 +- apps/funding/static/funding/funding.scss | 7 +++--- .../templates/funding/offer_detail.html | 2 +- .../funding/templates/funding/offer_list.html | 14 +++++++---- .../templates/funding/tags/funding.html | 7 +++--- apps/funding/templates/funding/thanks.html | 11 +++++++-- apps/funding/templatetags/funding_tags.py | 11 +++++---- apps/funding/urls.py | 6 ++--- apps/funding/views.py | 23 ++++++++++++++++--- .../templates/lesmianator/lesmianator.html | 10 ++++---- apps/pdcounter/static/pdcounter/pdcounter.js | 2 +- .../templates/pdcounter/author_detail.html | 2 +- .../templates/pdcounter/book_stub_detail.html | 2 +- apps/pdcounter/templatetags/time_tags.py | 12 +++++++--- apps/wolnelektury_core/static/css/base.css | 10 +++++++- .../wolnelektury_core/static/css/book_box.css | 5 ++++ .../static/css/catalogue.css | 7 ++++++ .../static/css/main_page.css | 5 ++++ wolnelektury/settings/__init__.py | 1 + 19 files changed, 103 insertions(+), 36 deletions(-) diff --git a/apps/funding/static/funding/funding.css b/apps/funding/static/funding/funding.css index 6c3ef37b4..538477390 100755 --- a/apps/funding/static/funding/funding.css +++ b/apps/funding/static/funding/funding.css @@ -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 diff --git a/apps/funding/static/funding/funding.scss b/apps/funding/static/funding/funding.scss index c5e8c48a3..435b0ac40 100755 --- a/apps/funding/static/funding/funding.scss +++ b/apps/funding/static/funding/funding.scss @@ -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; diff --git a/apps/funding/templates/funding/offer_detail.html b/apps/funding/templates/funding/offer_detail.html index 53c514f79..81007b08b 100755 --- a/apps/funding/templates/funding/offer_detail.html +++ b/apps/funding/templates/funding/offer_detail.html @@ -36,7 +36,7 @@ -

{% trans "Supporters" %}:

+

{% trans "Supporters" %}:

diff --git a/apps/funding/templates/funding/offer_list.html b/apps/funding/templates/funding/offer_list.html index 44cd82815..26f6a47bb 100755 --- a/apps/funding/templates/funding/offer_list.html +++ b/apps/funding/templates/funding/offer_list.html @@ -8,9 +8,13 @@ {% block body %}

{% trans "Support Wolne Lektury" %}

-
+ {% if funding.is_current and not forloop.is_last %} +

{% trans "Previous fundraisers:" %}

+ {% endif %} {% endfor %} - {% endblock %} diff --git a/apps/funding/templates/funding/tags/funding.html b/apps/funding/templates/funding/tags/funding.html index 981ae62f5..dd25247f7 100755 --- a/apps/funding/templates/funding/tags/funding.html +++ b/apps/funding/templates/funding/tags/funding.html @@ -11,10 +11,11 @@ {% endif %} {{ offer }} - {% trans "collected" %}: {{ offer.sum }} / {{ offer.target }} zł + {% trans "missing" %}: {{ missing }} zł + {% trans "collected" %}: {{ sum }} {% if is_current %} - {% trans "until fundraiser end" %}: - + {% trans "until fundraiser end" %}: + {% endif %} diff --git a/apps/funding/templates/funding/thanks.html b/apps/funding/templates/funding/thanks.html index 2863c6917..f3ca19f6f 100755 --- a/apps/funding/templates/funding/thanks.html +++ b/apps/funding/templates/funding/thanks.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load i18n %} -{% load funding_tags %} +{% load fnp_share %} {% block titleextra %}{% trans "Thank you!" %}{% endblock %} @@ -11,7 +11,14 @@ {% trans "Thank you for your support!" %} -

{% trans "Go back to the current fundraiser." %}

+ + +{% url 'funding_current' as current %} +

{% trans "Go back to the current fundraiser." %}

+ +{% url 'funding_current' as current %} +

{% share current 'y' %}

+ diff --git a/apps/funding/templatetags/funding_tags.py b/apps/funding/templatetags/funding_tags.py index 5331f8c4a..ae3b04f62 100755 --- a/apps/funding/templatetags/funding_tags.py +++ b/apps/funding/templatetags/funding_tags.py @@ -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, } diff --git a/apps/funding/urls.py b/apps/funding/urls.py index dc79f3130..7aed8dccf 100755 --- a/apps/funding/urls.py +++ b/apps/funding/urls.py @@ -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[^/]+)/$', OfferDetailView.as_view(), name='funding_offer'), url(r'^dziekujemy/$', ThanksView.as_view(), name='funding_thanks'), url(r'^fundusz/$', WLFundView.as_view(), name='funding_wlfund'), diff --git a/apps/funding/views.py b/apps/funding/views.py index c14cee3ee..3ea68b5f3 100644 --- a/apps/funding/views.py +++ b/apps/funding/views.py @@ -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" diff --git a/apps/lesmianator/templates/lesmianator/lesmianator.html b/apps/lesmianator/templates/lesmianator/lesmianator.html index 0148296e0..cc7decbc7 100644 --- a/apps/lesmianator/templates/lesmianator/lesmianator.html +++ b/apps/lesmianator/templates/lesmianator/lesmianator.html @@ -20,12 +20,12 @@

Przygotowaliśmy kilka propozycji na start – możesz wybrać jedną z nich, albo ułożyć sobie własną, niepowtarzalną mieszankę.

    -
  • Adam Mickiewicz, Liryki lozańskie

  • -
  • Adam Mickiewicz, Sonety krymskie

  • -
  • Jan Kasprowicz, Hymny

  • -
  • Bogurodzica

  • +
  • Adam Mickiewicz, Liryki lozańskie
  • +
  • Adam Mickiewicz, Sonety krymskie
  • +
  • Jan Kasprowicz, Hymny
  • +
  • Bogurodzica
  • {% for s in shelves %} -
  • {{ s.name }}

  • +
  • {{ s.name }}
  • {% endfor %} diff --git a/apps/pdcounter/static/pdcounter/pdcounter.js b/apps/pdcounter/static/pdcounter/pdcounter.js index 661fc9e14..a1ff53736 100755 --- a/apps/pdcounter/static/pdcounter/pdcounter.js +++ b/apps/pdcounter/static/pdcounter/pdcounter.js @@ -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); diff --git a/apps/pdcounter/templates/pdcounter/author_detail.html b/apps/pdcounter/templates/pdcounter/author_detail.html index 352b2050d..7ed5fa7b2 100644 --- a/apps/pdcounter/templates/pdcounter/author_detail.html +++ b/apps/pdcounter/templates/pdcounter/author_detail.html @@ -41,7 +41,7 @@ {% else %}

    {% trans "This author's works will become part of public domain and will be allowed to be published without restrictions in" %}

    -
    +

    {% trans "Find out why Internet libraries can't publish this author's works." %}

    {% endif %} diff --git a/apps/pdcounter/templates/pdcounter/book_stub_detail.html b/apps/pdcounter/templates/pdcounter/book_stub_detail.html index 03ba8fa16..af91fcbb6 100644 --- a/apps/pdcounter/templates/pdcounter/book_stub_detail.html +++ b/apps/pdcounter/templates/pdcounter/book_stub_detail.html @@ -18,7 +18,7 @@ {% else %} {% if book.pd %}

    {% trans "This work will become part of public domain and will be allowed to be published without restrictions in" %}

    -
    +

    {% trans "Find out why Internet libraries can't publish this work." %}

    {% else %}

    {% trans "This work is copyrighted." %} diff --git a/apps/pdcounter/templatetags/time_tags.py b/apps/pdcounter/templatetags/time_tags.py index 1d4f23a93..e454acd6b 100755 --- a/apps/pdcounter/templatetags/time_tags.py +++ b/apps/pdcounter/templatetags/time_tags.py @@ -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) ) diff --git a/apps/wolnelektury_core/static/css/base.css b/apps/wolnelektury_core/static/css/base.css index 5c29ef046..3496937ea 100755 --- a/apps/wolnelektury_core/static/css/base.css +++ b/apps/wolnelektury_core/static/css/base.css @@ -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"; diff --git a/apps/wolnelektury_core/static/css/book_box.css b/apps/wolnelektury_core/static/css/book_box.css index 74b710aff..190ddd773 100755 --- a/apps/wolnelektury_core/static/css/book_box.css +++ b/apps/wolnelektury_core/static/css/book_box.css @@ -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 { diff --git a/apps/wolnelektury_core/static/css/catalogue.css b/apps/wolnelektury_core/static/css/catalogue.css index 0e952ba7d..5f52f248c 100755 --- a/apps/wolnelektury_core/static/css/catalogue.css +++ b/apps/wolnelektury_core/static/css/catalogue.css @@ -49,6 +49,11 @@ 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; @@ -141,6 +147,7 @@ } .see-also h2, .download h2 { font-size: 1.1em; + margin: 0; } .see-also ul, .download ul { list-style: none; diff --git a/apps/wolnelektury_core/static/css/main_page.css b/apps/wolnelektury_core/static/css/main_page.css index 3db1655b7..a53b9de5e 100755 --- a/apps/wolnelektury_core/static/css/main_page.css +++ b/apps/wolnelektury_core/static/css/main_page.css @@ -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; diff --git a/wolnelektury/settings/__init__.py b/wolnelektury/settings/__init__.py index 1c743e540..7b1641c99 100644 --- a/wolnelektury/settings/__init__.py +++ b/wolnelektury/settings/__init__.py @@ -90,6 +90,7 @@ INSTALLED_APPS_CONTRIB = [ 'djkombu', 'honeypot', #'django_nose', + 'fnpdjango', #allauth stuff 'uni_form', -- 2.20.1