-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
background-image: url(/static/img/green-pixel.png);
background-repeat: repeat-y;
background-color: fade-out(#0D7E85, .8);
+
+ .mono {
+ font-size: .9em;
+ }
}
.wlfund {
}
-.funding-current {
- margin-bottom: 3em;
-}
.funding-stale {
.funding {
opacity: .5;
</div>
-<h2 style="font-size: 3em; margin: 1em 0 .5em;">{% trans "Supporters" %}:</h2>
+<h2>{% trans "Supporters" %}:</h2>
<div class="white-box normal-text">
{% 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 %}
{% 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>
{% 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>
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,
}
# 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'),
#
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
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):
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):
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"
<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>
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);
{% 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 %}
{% 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." %}
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)
)
}
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";
.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 {
list-style: none;
}
+#book-a-list #book-list h2 {
+ font-size: 1em;
+ margin: 0;
+}
+
#book-a-list #book-list h2 a {
color: black;
}
.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;
}
#promo-box-header h2 {
font-size: 1.3em;
+ margin: 0;
}
#promo-box-body {
border-bottom: 2px solid #efefef;
padding-top: 1.9em;
height: 3.2em;
padding-left: 1.9em;
+ margin: 0;
+ font-size: 1em;
}
.main-last span {
font-size: 1.1em;
color: #017e85;
height: 2.8em;
padding-top: 2.5em;
+ font-size: 1em;
+ margin: 0;
}
.infopages-box h2 span {
font-size: 1.1em;
'djkombu',
'honeypot',
#'django_nose',
+ 'fnpdjango',
#allauth stuff
'uni_form',