From: Radek Czajka Date: Fri, 18 Nov 2022 14:28:08 +0000 (+0100) Subject: Schedules, fundings, polls, libraries X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/149ca28f533a257ed8034f88a615c8d7abbc9f69 Schedules, fundings, polls, libraries --- diff --git a/src/club/admin.py b/src/club/admin.py index ce74ec61b..2f07a4f41 100644 --- a/src/club/admin.py +++ b/src/club/admin.py @@ -1,3 +1,4 @@ + # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # @@ -5,6 +6,7 @@ import json from django.contrib import admin from django.db.models.functions import Now from django.db.models import Q +from django import forms from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ @@ -67,11 +69,26 @@ class ExpiredFilter(YesNoFilter): q = Q(expires_at__isnull=False, expires_at__lt=Now()) +class ScheduleForm(forms.ModelForm): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields['email'].required = False + self.fields['method'].required = False + self.fields['consent'].required = False + + class Meta: + model = models.Schedule + fields = '__all__' + + class ScheduleAdmin(admin.ModelAdmin): + form = ScheduleForm + list_display = [ 'email', 'started_at', 'payed_at', 'expires_at', 'amount', 'monthly', 'yearly', 'is_cancelled', 'method' ] + list_display_links = ['email', 'started_at'] search_fields = ['email'] list_filter = ['is_cancelled', 'monthly', 'yearly', 'method', PayedFilter, ExpiredFilter, 'source'] filter_horizontal = ['consent'] diff --git a/src/club/templates/club/index.html b/src/club/templates/club/index.html index 4268be1ad..ecc2ef982 100644 --- a/src/club/templates/club/index.html +++ b/src/club/templates/club/index.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} {% load active_schedule from club %} {% load chunks %} @@ -8,9 +8,9 @@ {% block body %} -
-

{% trans "Wolne Lektury need your help!" %}

+

{% trans "Wolne Lektury need your help!" %}

+
{% chunk 'club' %} diff --git a/src/club/templates/club/schedule.html b/src/club/templates/club/schedule.html index 422d32324..84b6833b6 100644 --- a/src/club/templates/club/schedule.html +++ b/src/club/templates/club/schedule.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} @@ -6,12 +6,12 @@ {% block body %} -

Cieszymy się, że jesteś z nami! Dziękujemy za wsparcie!

-

+

+

{% if schedule.payed_at %} diff --git a/src/funding/templates/funding/2022/includes/funding_box.html b/src/funding/templates/funding/2022/includes/funding_box.html new file mode 100644 index 000000000..c04234dfc --- /dev/null +++ b/src/funding/templates/funding/2022/includes/funding_box.html @@ -0,0 +1,23 @@ +{% load i18n %} +{% load sorl_thumbnail %} + +

diff --git a/src/funding/templates/funding/2022/offer_detail.html b/src/funding/templates/funding/2022/offer_detail.html index 0812e83a7..920f84440 100644 --- a/src/funding/templates/funding/2022/offer_detail.html +++ b/src/funding/templates/funding/2022/offer_detail.html @@ -66,6 +66,7 @@
{{ object.status }} {{ object.status_more }} + {% chunk 'funding_rules' %}
@@ -101,9 +102,7 @@ {% fundings object %} - {# pomóż uwolnić #} {# 1% #} {# share? #} - {% endblock %} diff --git a/src/funding/templates/funding/2022/offer_list.html b/src/funding/templates/funding/2022/offer_list.html new file mode 100644 index 000000000..b7528ea19 --- /dev/null +++ b/src/funding/templates/funding/2022/offer_list.html @@ -0,0 +1,29 @@ +{% extends '2022/base.html' %} + + +{% block settings %} + {% load title %} + {% title 'X' %} +{% endblock %} + + +{% block main %} +
+
+
+ + +
+
+
+ + +
+
+ {% for funding in object_list %} + {% include "funding/2022/includes/funding_box.html" %} + {% endfor %} +
+
+ +{% endblock %} diff --git a/src/funding/templates/funding/disable_notifications.html b/src/funding/templates/funding/disable_notifications.html index ed5c3a677..2763217e0 100644 --- a/src/funding/templates/funding/disable_notifications.html +++ b/src/funding/templates/funding/disable_notifications.html @@ -1,8 +1,8 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} {% load fnp_share %} -{% block titleextra %}{% trans "Payment failed" %}{% endblock %} +{% block titleextra %}{% trans "Disable notifications" %}{% endblock %} {% block body %}

{% trans "Disable notifications" %}

diff --git a/src/funding/templates/funding/no_thanks.html b/src/funding/templates/funding/no_thanks.html index b9f25959f..ca62ad4fb 100644 --- a/src/funding/templates/funding/no_thanks.html +++ b/src/funding/templates/funding/no_thanks.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} {% load fnp_share %} diff --git a/src/funding/templates/funding/thanks.html b/src/funding/templates/funding/thanks.html index d3f5dc610..9ad0cdd85 100644 --- a/src/funding/templates/funding/thanks.html +++ b/src/funding/templates/funding/thanks.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} {% load fnp_share %} {% load polls_tags %} diff --git a/src/funding/templates/funding/wlfund.html b/src/funding/templates/funding/wlfund.html index a86735219..ed872e426 100644 --- a/src/funding/templates/funding/wlfund.html +++ b/src/funding/templates/funding/wlfund.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} {% block titleextra %}{% trans "Remaining funds" %}{% endblock %} diff --git a/src/funding/views.py b/src/funding/views.py index d34eccc00..6df231dfd 100644 --- a/src/funding/views.py +++ b/src/funding/views.py @@ -127,6 +127,11 @@ class CurrentView(OfferDetailView): class OfferListView(ListView): queryset = Offer.public() + def get_template_names(self): + if self.request.EXPERIMENTS['layout'].value: + return 'funding/2022/offer_list.html' + return 'funding/offer_list.html' + def get_context_data(self, **kwargs): ctx = super(OfferListView, self).get_context_data(**kwargs) ctx['funding_no_show_current'] = True diff --git a/src/libraries/templates/libraries/catalog_view.html b/src/libraries/templates/libraries/catalog_view.html index 2a022d47b..42b30f7d5 100644 --- a/src/libraries/templates/libraries/catalog_view.html +++ b/src/libraries/templates/libraries/catalog_view.html @@ -1,6 +1,16 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} +{% block settings %} + {% load title %} + {% trans 'Library directories' as title %} + {% title title %} +{% endblock %} + +{% block breadcrumbs %} + {% trans 'Libraries directory' %} +{% endblock %} + {% block titleextra %}{% trans 'Libraries directory' %}{% endblock %} @@ -15,4 +25,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/libraries/templates/libraries/library_view.html b/src/libraries/templates/libraries/library_view.html index 283d1c047..855231434 100644 --- a/src/libraries/templates/libraries/library_view.html +++ b/src/libraries/templates/libraries/library_view.html @@ -1,6 +1,16 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} +{% block settings %} + {% load title %} + {% title library.name %} +{% endblock %} + +{% block breadcrumbs %} + {% trans 'Libraries directory' %} + {{ library.catalog.name }} +{% endblock %} + {% block titleextra %}{{ library.name }}{% endblock %} {% block body %} @@ -9,4 +19,4 @@

Adres strony www: {{library.url}}

{% autoescape off %}{{library.description}}{% endautoescape%}
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/libraries/templates/libraries/main_view.html b/src/libraries/templates/libraries/main_view.html index 3593616a6..051a82abe 100644 --- a/src/libraries/templates/libraries/main_view.html +++ b/src/libraries/templates/libraries/main_view.html @@ -1,6 +1,12 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} +{% block settings %} + {% load title %} + {% trans 'Library directories' as title %} + {% title title %} +{% endblock %} + {% block titleextra %}{% trans 'Library directories' %}{% endblock %} {% block body %} @@ -14,4 +20,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/polls/templates/polls/poll.html b/src/polls/templates/polls/poll.html index e57d9cd50..c87ea4fb8 100644 --- a/src/polls/templates/polls/poll.html +++ b/src/polls/templates/polls/poll.html @@ -1,4 +1,4 @@ -{% extends "base/base.html" %} +{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} {% load i18n %} {% load polls_tags %} @@ -6,10 +6,11 @@ {% block body %} +

Ankieta

{% if voted_already %}

{% trans "Thanks for voting! You can see current results below." %}

{% endif %} {% poll poll %}
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/polls/templates/polls/tags/poll.html b/src/polls/templates/polls/tags/poll.html index b4a4e7f7b..803726618 100644 --- a/src/polls/templates/polls/tags/poll.html +++ b/src/polls/templates/polls/tags/poll.html @@ -17,7 +17,8 @@ {% endif %} {% else %}
-

{{poll.question}}

+

{{poll.question}}

+
{% csrf_token %} {{ form.vote }} diff --git a/src/wolnelektury/static/2022/more.scss b/src/wolnelektury/static/2022/more.scss index 0a2ba062e..3733e3ca2 100644 --- a/src/wolnelektury/static/2022/more.scss +++ b/src/wolnelektury/static/2022/more.scss @@ -451,6 +451,10 @@ form { } } +.l-checkout__support__bar { + overflow: hidden; +} + .l-change-pop { margin-bottom: 18px; @@ -465,3 +469,21 @@ form { background: #92BD39; } } + + +.poll-bar { + height: 10px; + width: 100%; + display: block; + border-radius: 5px; + position: relative; + overflow: hidden; + + .poll-bar-inner { + height: 100%; + position: absolute; + border-radius: 5px; + background-color: #006066; + top: 0; left: 0; + } +}