diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo index 9e44d41..d97e0dc 100644 Binary files a/locale/en/LC_MESSAGES/django.mo and b/locale/en/LC_MESSAGES/django.mo differ diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 576a084..d5b3b4c 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-18 11:11+0300\n" +"POT-Creation-Date: 2017-10-18 12:06+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -168,7 +168,7 @@ msgid "id" msgstr "id" #: infoscreen/templates/infoscreen_admin.html:141 webapp/models.py:110 -#: webapp/models.py:144 webapp/templates/kaehmy_list.html:40 +#: webapp/models.py:144 webapp/templates/kaehmy_list.html:36 msgid "Name" msgstr "Name" @@ -209,7 +209,7 @@ msgid "Last name" msgstr "Last name" #: members/models.py:16 webapp/models.py:145 -#: webapp/templates/kaehmy_list.html:44 +#: webapp/templates/kaehmy_list.html:40 msgid "Email" msgstr "Email" @@ -351,7 +351,7 @@ msgstr "" #: members/templates/member_add_many.html:48 #: members/templates/member_add_many_confirm.html:22 -#: webapp/templates/kaehmy_list.html:52 +#: webapp/templates/kaehmy_list.html:48 msgid "Send" msgstr "Send" @@ -891,28 +891,34 @@ msgstr "Deadline to apply as a non-board official!" msgid "Vaalikokous, osa 3 (toimarien valinta)" msgstr "Election meeting, part 3 (non-board election)" -#: webapp/templates/kaehmy_list.html:24 +#: webapp/templates/kaehmy_list.html:24 webapp/templates/kaehmy_list.html:59 msgid "All kaehmys" msgstr "All applications" -#: webapp/templates/kaehmy_list.html:28 +#: webapp/templates/kaehmy_list.html:32 +msgid "Commenting on post by " +msgstr "" + +#: webapp/templates/kaehmy_list.html:44 +msgid "Comment" +msgstr "" + +#: webapp/templates/kaehmy_list.html:57 +#, fuzzy +#| msgid "List kaehmys" +msgid "Filter kaehmys" +msgstr "List applications" + +#: webapp/templates/kaehmy_list.html:70 #: webapp/templates/kaehmy_statistics.html:18 msgid "Total kaehmys:" msgstr "Total applications:" -#: webapp/templates/kaehmy_list.html:36 -msgid "Commenting on post by " -msgstr "" - -#: webapp/templates/kaehmy_list.html:48 -msgid "Comment" -msgstr "" - -#: webapp/templates/kaehmy_list.html:73 +#: webapp/templates/kaehmy_list.html:88 msgid "Show comments" msgstr "" -#: webapp/templates/kaehmy_list.html:79 +#: webapp/templates/kaehmy_list.html:94 msgid "Add comment" msgstr "" diff --git a/locale/fi/LC_MESSAGES/django.mo b/locale/fi/LC_MESSAGES/django.mo index 97561be..18db113 100644 Binary files a/locale/fi/LC_MESSAGES/django.mo and b/locale/fi/LC_MESSAGES/django.mo differ diff --git a/locale/fi/LC_MESSAGES/django.po b/locale/fi/LC_MESSAGES/django.po index 3b28c11..9de7b01 100644 --- a/locale/fi/LC_MESSAGES/django.po +++ b/locale/fi/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-18 11:11+0300\n" +"POT-Creation-Date: 2017-10-18 12:06+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -169,7 +169,7 @@ msgid "id" msgstr "id" #: infoscreen/templates/infoscreen_admin.html:141 webapp/models.py:110 -#: webapp/models.py:144 webapp/templates/kaehmy_list.html:40 +#: webapp/models.py:144 webapp/templates/kaehmy_list.html:36 msgid "Name" msgstr "Nimi" @@ -210,7 +210,7 @@ msgid "Last name" msgstr "Sukunimi" #: members/models.py:16 webapp/models.py:145 -#: webapp/templates/kaehmy_list.html:44 +#: webapp/templates/kaehmy_list.html:40 msgid "Email" msgstr "Sähköposti" @@ -356,7 +356,7 @@ msgstr "" #: members/templates/member_add_many.html:48 #: members/templates/member_add_many_confirm.html:22 -#: webapp/templates/kaehmy_list.html:52 +#: webapp/templates/kaehmy_list.html:48 msgid "Send" msgstr "Lähetä" @@ -874,28 +874,32 @@ msgstr "" msgid "Vaalikokous, osa 3 (toimarien valinta)" msgstr "" -#: webapp/templates/kaehmy_list.html:24 +#: webapp/templates/kaehmy_list.html:24 webapp/templates/kaehmy_list.html:59 msgid "All kaehmys" msgstr "Kaikki kaehmyt" -#: webapp/templates/kaehmy_list.html:28 +#: webapp/templates/kaehmy_list.html:32 +msgid "Commenting on post by " +msgstr "Kommentoidaan viestiin lähettäjältä" + +#: webapp/templates/kaehmy_list.html:44 +msgid "Comment" +msgstr "Kommentti" + +#: webapp/templates/kaehmy_list.html:57 +msgid "Filter kaehmys" +msgstr "Rajaa kaehmyjä" + +#: webapp/templates/kaehmy_list.html:70 #: webapp/templates/kaehmy_statistics.html:18 msgid "Total kaehmys:" msgstr "Kaehmyjä yhteensä:" -#: webapp/templates/kaehmy_list.html:36 -msgid "Commenting on post by " -msgstr "Kommentoidaan viestiin lähettäjältä" - -#: webapp/templates/kaehmy_list.html:48 -msgid "Comment" -msgstr "Kommentti" - -#: webapp/templates/kaehmy_list.html:73 +#: webapp/templates/kaehmy_list.html:88 msgid "Show comments" msgstr "Näytä kommentit" -#: webapp/templates/kaehmy_list.html:79 +#: webapp/templates/kaehmy_list.html:94 msgid "Add comment" msgstr "Kommentoi" diff --git a/webapp/static/css/webapp.css b/webapp/static/css/webapp.css index 1a745fa..ff016f1 100644 --- a/webapp/static/css/webapp.css +++ b/webapp/static/css/webapp.css @@ -17,4 +17,10 @@ div.tooltip-inner { .tooltip { margin-left: 1rem; +} + +.role-filter-form { + max-width: 30rem; + width: auto; + margin-bottom: 1rem; } \ No newline at end of file diff --git a/webapp/templates/kaehmy_list.html b/webapp/templates/kaehmy_list.html index e9b81ca..8167801 100644 --- a/webapp/templates/kaehmy_list.html +++ b/webapp/templates/kaehmy_list.html @@ -24,10 +24,6 @@

{% trans "All kaehmys" %}

-
-
{% trans "Total kaehmys:" %} {{ application_count }}
-
-
@@ -56,6 +52,25 @@
+
+
+ + +
+
+ +
+
{% trans "Total kaehmys:" %} {{ application_count }}
+
+ + {% for application in applications %}

{{ application.name }}

diff --git a/webapp/views.py b/webapp/views.py index 9c3f522..3638425 100644 --- a/webapp/views.py +++ b/webapp/views.py @@ -1,5 +1,6 @@ """Webapp views.""" +from django.db.models import Count from django.shortcuts import render, redirect from django.contrib.auth import login, logout, authenticate from django.views.decorators.http import require_http_methods @@ -226,11 +227,20 @@ def ohlhafv_list(request, *args, **kwargs): def kaehmy_list_view(request, *args, **kwargs): """Kaehmy application list""" - applications = KaehmyForm.objects.order_by('-timestamp') + role_filter = request.GET.get('role', None) + if role_filter is not None and str(role_filter) != '-1': + applications = KaehmyForm.objects.filter(custom_roles__id=role_filter) | KaehmyForm.objects.filter(preset_roles__id=role_filter) + else: + applications = KaehmyForm.objects.all() + + applications = applications.order_by('-timestamp') + filter_options_preset = PresetKaehmyRole.objects.annotate(form_count=Count('forms')).filter(form_count__gt=0) + filter_options = [(r.id, r.name, r.form_count) for r in filter_options_preset] context = { 'applications': applications, - 'application_count': len(applications) + 'application_count': len(applications), + 'filter_options': filter_options } return render(request, 'kaehmy_list.html', context)