$target.slideDown('fast');
$on.hide();
if (Modernizr.localstorage) localStorage.removeItem(tag);
- _paq.push(['trackEvent', 'banner', 'unhide', $on.attr('data-target')]);
+ _paq.push(['trackEvent', 'banner', 'banner-unhide', $target.attr('id')]);
});
$off.click(function() {
$target.slideUp('fast');
$on.show();
if (Modernizr.localstorage) localStorage[tag] = true;
- _paq.push(['trackEvent', 'banner', 'hide', $on.attr('data-target')]);
+ _paq.push(['trackEvent', 'banner', 'banner-hide', $target.attr('id')]);
});
if (Modernizr.localstorage) {
if (!localStorage[tag]) {
$on.hide();
$target.show();
- _paq.push(['trackEvent', 'banner', 'show', $on.attr('data-target')]);
+ _paq.push(['trackEvent', 'banner', 'banner-show', $target.attr('id')]);
}
}
});
$(document).on('click', ".annoy-banner a", function() {
banner = $(this).closest('.annoy-banner');
- _paq.push(['trackEvent', 'banner', 'click', banner.attr('id')]);
+ _paq.push(['trackEvent', 'banner', 'banner-click', banner.attr('id')]);
});
$(document).on('click', ".dynamic-insert a", function() {
banner = $(this).closest('.dynamic-insert');
- _paq.push(['trackEvent', 'dynamic-insert', 'click', banner.attr('data-paragraphs'), banner.attr('data-textid')]);
+ _paq.push(['trackEvent', 'dynamic-insert', 'dynamic-insert-click', 'insert-' + banner.attr('data-paragraphs') + '-pars-text-' + banner.attr('data-textid')]);
});
});
--- /dev/null
+{% extends "admin/change_list.html" %}
+{% load club %}
+
+{% block content %}
+ <p>Aktywne miesięczne wpłaty: {% club_active_monthly_count %} sztuk, {% club_active_monthly_sum %} zł.</p>
+ {{ block.super }}
+{% endblock content %}
{% extends request.session.from_app|yesno:"base/app.html,base/base.html" %}
{% load chunks %}
{% load thumbnail %}
+{% load club %}
{% block titleextra %}Uwalniaj książki razem z nami!{% endblock %}
{% block metadescription %}„Wolne Lektury należy wspierać, bo są” - Filip Springer{% endblock %}
<h2 style="margin-bottom:2em;">
{% if membership %}Dziękujemy za Twoje dotychczasowe zaangażowanie! Wesprzyj nas ponownie!{% else %}Dziękujemy, że chcesz razem z nami uwalniać książki!{% endif %}</h2>
+ {% with schedule=request.user|active_schedule %}
+ {% if schedule %}
+ <p><a href="{{ schedule.get_absolute_url }}">Zobacz swoje dotychczasowe wsparcie.</a></p>
+ {% endif %}
+ {% endwith %}
+
{% chunk 'club_form_top' %}
<div class='twocol'>
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
+from django.db.models import Sum
from django import template
+from django.utils.timezone import now
from ..helpers import get_active_schedule
+from ..models import Schedule
register = template.Library()
@register.filter
def active_schedule(user):
return get_active_schedule(user)
+
+
+@register.simple_tag
+def club_active_monthly_count():
+ return Schedule.objects.filter(expires_at__gt=now(), monthly=True, is_cancelled=False).count()
+
+@register.simple_tag
+def club_active_monthly_sum():
+ return Schedule.objects.filter(expires_at__gt=now(), monthly=True, is_cancelled=False).aggregate(s=Sum('amount'))['s']
+
request.session['from_app'] = True
elif request.session and 'from_app' in request.session:
del request.session['from_app']
- schedule = get_active_schedule(request.user)
- if schedule is not None:
- return HttpResponseRedirect(schedule.get_absolute_url())
- else:
- return super(JoinView, self).get(request)
+ #schedule = get_active_schedule(request.user)
+ #if schedule is not None:
+ # return HttpResponseRedirect(schedule.get_absolute_url())
+ #else:
+ return super(JoinView, self).get(request)
def get_context_data(self, **kwargs):
c = super(JoinView, self).get_context_data(**kwargs)
return HttpResponseRedirect(schedule.get_absolute_url())
-class PayUPayment(payu_views.Payment):
- pass
+class PayUPayment(DetailView):
+ model = models.Schedule
+ slug_field = slug_url_kwarg = 'key'
+
+ def get(self, request, key):
+ schedule = self.get_object()
+ return HttpResponseRedirect(schedule.initiate_payment(request))
+
class PayURecPayment(payu_views.RecPayment):