From f9a3632c1091a9134a1f22dee6d32d8e88742250 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Feb 2025 16:34:47 +0100 Subject: [PATCH 1/8] Review fuzzy translations --- locale/de/LC_MESSAGES/django.po | 76 ++++++++------------------------- 1 file changed, 18 insertions(+), 58 deletions(-) diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index e5d61e9..75f5bc1 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -240,20 +240,16 @@ msgid "groups" msgstr "Gruppen" #: mpicms/personal/models.py:31 -#, fuzzy -#| msgid "groups" msgid "group" -msgstr "Gruppen" +msgstr "Gruppe" #: mpicms/personal/models.py:44 msgid "positions" msgstr "Positionen" #: mpicms/personal/models.py:50 -#, fuzzy -#| msgid "positions" msgid "position" -msgstr "Positionen" +msgstr "Position" #: mpicms/personal/models.py:83 msgid "status" @@ -507,17 +503,13 @@ msgstr "" #: mpicms/templates/wagtailusers/users/list.html:8 #: mpicms/templates/wagtailusers/users/list.html:12 -#, fuzzy -#| msgid "Last Name" msgid "Name" msgstr "Nachname" #: mpicms/templates/wagtailusers/users/list.html:19 #: mpicms/templates/wagtailusers/users/list.html:23 -#, fuzzy -#| msgid "name" msgid "Username" -msgstr "Name" +msgstr "Benutzername" #: mpicms/templates/wagtailusers/users/list.html:27 msgid "Level" @@ -529,26 +521,20 @@ msgid "Status" msgstr "" #: mpicms/templates/wagtailusers/users/list.html:30 -#, fuzzy -#| msgid "Login" msgid "Last Login" -msgstr "Einloggen" +msgstr "Letzter Login" #: mpicms/templates/wagtailusers/users/list.html:46 msgid "Admin" msgstr "" #: mpicms/templates/wagtailusers/users/list.html:48 -#, fuzzy -#| msgid "is active" msgid "Active" -msgstr "ist aktiv" +msgstr "Aktiv" #: mpicms/templates/wagtailusers/users/list.html:48 -#, fuzzy -#| msgid "is active" msgid "Inactive" -msgstr "ist aktiv" +msgstr "Inaktiv" #: mpicms/templates/wagtailusers/users/list.html:49 #, python-format @@ -563,10 +549,8 @@ msgstr "" #: mpicms/users/views.py:34 #: venv0/lib/python3.7/site-packages/wagtailvideos/forms.py:80 #: venv0/lib/python3.7/site-packages/wagtailvideos/views/videos.py:177 -#, fuzzy -#| msgid "Editor" msgid "Edit" -msgstr "Editor" +msgstr "Editeren" #: mpicms/users/views.py:42 msgid "The user could not be saved due to errors." @@ -1828,17 +1812,13 @@ msgid "This slug is already in use" msgstr "" #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/patch_wagtailadmin_forms.py:44 -#, fuzzy -#| msgid "title" msgid "New title" -msgstr "Titel" +msgstr "Neuer Titel" #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/patch_wagtailadmin_forms.py:50 #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/patch_wagtailadmin_forms.py:53 -#, fuzzy -#| msgid "slug" msgid "New slug" -msgstr "Kürzel" +msgstr "Neues Kürzel" #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/patch_wagtailadmin_forms.py:59 msgid "New parent page" @@ -1849,10 +1829,8 @@ msgid "This copy will be a child of this given parent page." msgstr "" #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/patch_wagtailadmin_forms.py:66 -#, fuzzy -#| msgid "root pages" msgid "Copy subpages" -msgstr "Grundseiten" +msgstr "Kopiere Unterseiten" #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/patch_wagtailadmin_forms.py:68 #, python-format @@ -1870,8 +1848,6 @@ msgid "This page is live. Would you like to publish its copy as well?" msgstr "" #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/patch_wagtailadmin_forms.py:80 -#, fuzzy -#| msgid "Publications" msgid "Publish copies" msgstr "Publikationen" @@ -1911,10 +1887,8 @@ msgid "Copy" msgstr "" #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/templates/modeltranslation_copy.html:19 -#, fuzzy -#| msgid "root page" msgid "Copy this page" -msgstr "Grundseite" +msgstr "Kopiere diese Seite" #: venv0/lib/python3.7/site-packages/wagtail_modeltranslation/wagtail_hooks.py:77 msgid "View / edit fields for" @@ -2052,10 +2026,8 @@ msgid "Video updated." msgstr "" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/multiple/edit_form.html:13 -#, fuzzy -#| msgid "date" msgid "Update" -msgstr "Datum" +msgstr "Aktualisieren" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/permissions/includes/video_permissions_formset.html:4 msgid "Video permissions" @@ -2084,10 +2056,8 @@ msgstr "" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/confirm_delete.html:4 #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/confirm_delete.html:7 -#, fuzzy -#| msgid "featured image" msgid "Delete image" -msgstr "Titelbild" +msgstr "Lösche Bild" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/confirm_delete.html:15 msgid "Are you sure you want to delete this video?" @@ -2103,20 +2073,16 @@ msgid "Editing video %(title)s" msgstr "" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/edit.html:20 -#, fuzzy -#| msgid "Editor" msgid "Editing" -msgstr "Editor" +msgstr "Editieren" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/edit.html:41 msgid "Delete video" msgstr "" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/edit.html:47 -#, fuzzy -#| msgid "This is a preview" msgid "Video preview" -msgstr "Dies ist eine Vorschau" +msgstr "Videovorschau" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/edit.html:85 msgid "Thumbnail" @@ -2127,10 +2093,8 @@ msgid "Filesize" msgstr "" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/edit.html:89 -#, fuzzy -#| msgid "No events found" msgid "File not found" -msgstr "Keine Veranstaltungen gefunden" +msgstr "Datei nicht gefunden" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/edit.html:95 msgid "Usage" @@ -2190,17 +2154,13 @@ msgid "Type" msgstr "" #: venv0/lib/python3.7/site-packages/wagtailvideos/templates/wagtailvideos/videos/usage.html:26 -#, fuzzy -#| msgid "root page" msgid "Edit this page" -msgstr "Grundseite" +msgstr "Diese Seite editieren" #: venv0/lib/python3.7/site-packages/wagtailvideos/views/videos.py:39 #: venv0/lib/python3.7/site-packages/wagtailvideos/views/videos.py:45 -#, fuzzy -#| msgid "Search contacts" msgid "Search videos" -msgstr "Telefonliste durchsuchen" +msgstr "Videos durchsuchen" #: venv0/lib/python3.7/site-packages/wagtailvideos/views/videos.py:106 #, python-brace-format From 595f93765b2c3e7313538adccf3fc2c82745c32c Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Feb 2025 13:13:26 +0100 Subject: [PATCH 2/8] personal/list: Add Special Functions --- mpicms/templates/personal/list.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mpicms/templates/personal/list.html b/mpicms/templates/personal/list.html index 68a3b58..0b83be6 100644 --- a/mpicms/templates/personal/list.html +++ b/mpicms/templates/personal/list.html @@ -43,6 +43,7 @@

{% trans 'Contact List' %}

{% trans 'Phone' %} {% trans 'Room' %} {% trans 'Positions' %} + {% trans 'Special Functions' %} {% trans 'Groups' %} @@ -56,6 +57,7 @@

{% trans 'Contact List' %}

{{ contact.phone }} {{ contact.room | add_room_links }} {% for contactposition in contact.positions.all %}{{ contactposition.position }}
{% endfor %} + {% for specialfunction in contact.special_functions.all %}{{ specialfunction.title }}
{% endfor %} {% for contactgroup in contact.groups.all %}{{ contactgroup.group }}
{% endfor %} {% endfor %} @@ -65,7 +67,7 @@

{% trans 'Contact List' %}

From 2a94ea09b2b68a3f3ef875c61336dbea83f4bc17 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Feb 2025 16:07:31 +0100 Subject: [PATCH 3/8] personal/list: Show groups before positions, special functions Often the tables is to wide and the vertical scollbar is difficult to find, because it is at the bottom and the user needs to scroll all the way vertically first. Plus, most browsers nowadays try there best to hide scrollbars. Display the groups column first, because generally it is more impostant than positions or special functions. --- mpicms/templates/personal/list.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mpicms/templates/personal/list.html b/mpicms/templates/personal/list.html index 0b83be6..50bd19b 100644 --- a/mpicms/templates/personal/list.html +++ b/mpicms/templates/personal/list.html @@ -42,9 +42,9 @@

{% trans 'Contact List' %}

{% trans 'Email' %} {% trans 'Phone' %} {% trans 'Room' %} + {% trans 'Groups' %} {% trans 'Positions' %} {% trans 'Special Functions' %} - {% trans 'Groups' %} @@ -56,9 +56,9 @@

{% trans 'Contact List' %}

{{ contact.email }} {{ contact.phone }} {{ contact.room | add_room_links }} + {% for contactgroup in contact.groups.all %}{{ contactgroup.group }}
{% endfor %} {% for contactposition in contact.positions.all %}{{ contactposition.position }}
{% endfor %} {% for specialfunction in contact.special_functions.all %}{{ specialfunction.title }}
{% endfor %} - {% for contactgroup in contact.groups.all %}{{ contactgroup.group }}
{% endfor %} {% endfor %} From e60b220cc6757c6547d9d4f221269013ba30da34 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Feb 2025 16:26:48 +0100 Subject: [PATCH 4/8] personal/admin: Translate "Special Functions" and "Written Consent" menu entries --- mpicms/personal/wagtail_hooks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mpicms/personal/wagtail_hooks.py b/mpicms/personal/wagtail_hooks.py index 8e3565b..cdc1a3a 100644 --- a/mpicms/personal/wagtail_hooks.py +++ b/mpicms/personal/wagtail_hooks.py @@ -85,11 +85,13 @@ class StatusAdmin(ModelAdmin): class SpecialFunctionAdmin(ModelAdmin): model = SpecialFunction + menu_label = _('Special Functions') menu_icon = 'tag' class WrittenConsentAdmin(ModelAdmin): model = WrittenConsent + menu_label = _('Written Consent') menu_icon='doc-full' From 593a110896f12b6bb9ac60c2d303c2a05d182bb1 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Feb 2025 17:00:31 +0100 Subject: [PATCH 5/8] personal/admin: Use plural in menu --- mpicms/personal/wagtail_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpicms/personal/wagtail_hooks.py b/mpicms/personal/wagtail_hooks.py index cdc1a3a..225e7d0 100644 --- a/mpicms/personal/wagtail_hooks.py +++ b/mpicms/personal/wagtail_hooks.py @@ -91,7 +91,7 @@ class SpecialFunctionAdmin(ModelAdmin): class WrittenConsentAdmin(ModelAdmin): model = WrittenConsent - menu_label = _('Written Consent') + menu_label = _('Written Consents') menu_icon='doc-full' From 6d45716ac23881494e28a32ff86d12dbe8b7c8d8 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Feb 2025 13:18:40 +0100 Subject: [PATCH 6/8] Update translations --- locale/de/LC_MESSAGES/django.po | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 75f5bc1..0b56cff 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-15 14:56+0100\n" +"POT-Creation-Date: 2025-02-04 17:06+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -84,7 +84,7 @@ msgstr "Generiere Inhaltsverzeichnis" msgid "Page not available in %s" msgstr "Seite auf %s nicht vorhanden" -#: mpicms/base/mixins.py:94 mpicms/personal/wagtail_hooks.py:97 +#: mpicms/base/mixins.py:94 mpicms/personal/wagtail_hooks.py:99 msgid "Contacts" msgstr "Kontakte" @@ -320,16 +320,24 @@ msgid "Persons" msgstr "Personen" #: mpicms/personal/wagtail_hooks.py:52 mpicms/personal/wagtail_hooks.py:69 -#: mpicms/templates/personal/list.html:46 +#: mpicms/templates/personal/list.html:45 #: mpicms/templates/wagtailusers/users/list.html:28 msgid "Groups" msgstr "Gruppen" #: mpicms/personal/wagtail_hooks.py:57 mpicms/personal/wagtail_hooks.py:76 -#: mpicms/templates/personal/list.html:45 +#: mpicms/templates/personal/list.html:46 msgid "Positions" msgstr "Positionen" +#: mpicms/personal/wagtail_hooks.py:88 mpicms/templates/personal/list.html:47 +msgid "Special Functions" +msgstr "Sonderfunktionen" + +#: mpicms/personal/wagtail_hooks.py:94 +msgid "Written Consents" +msgstr "Einwilligungen" + #: mpicms/publications/models.py:28 msgid "authors" msgstr "Autoren" From 50dd4a655704c9a615892ce96ad755d48cac2d07 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 6 Feb 2025 15:51:49 +0100 Subject: [PATCH 7/8] contactlist: Add selector for Position and Special Function --- mpicms/personal/views.py | 39 ++++++++++++++---- mpicms/templates/personal/list.html | 61 +++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 11 deletions(-) diff --git a/mpicms/personal/views.py b/mpicms/personal/views.py index 740eeca..8ccea1e 100644 --- a/mpicms/personal/views.py +++ b/mpicms/personal/views.py @@ -1,7 +1,7 @@ from django.views.generic.list import ListView from django.shortcuts import get_object_or_404 -from .models import Contact, Group +from .models import Contact, Group, Position, SpecialFunction class ContactListView(ListView): @@ -9,17 +9,42 @@ class ContactListView(ListView): def get_queryset(self): group_pk = self.request.GET.get('group') - if group_pk: - members = Group.objects.get(pk=group_pk).members - return super().get_queryset().filter(pk__in=[member.pk for member in members]) - return super().get_queryset() + position_pk = self.request.GET.get('position') + special_function_pk = self.request.GET.get('special_function') + qs = super().get_queryset(); + if group_pk is not None and group_pk != "": + qs = qs.filter(groups__group_id=group_pk) + + if position_pk is not None and position_pk != "": + qs = qs.filter(positions__position_id=position_pk) + + if special_function_pk is not None and special_function_pk != "": + qs = qs.filter(special_functions=special_function_pk) + + return qs + def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['groups'] = Group.objects.all().order_by("name") + context['positions'] = Position.objects.all().order_by("title") + context['special_functions'] = SpecialFunction.objects.all().order_by("title") + group_pk = self.request.GET.get('group') - context['selected_group_pk'] = group_pk - context['selected_group'] = get_object_or_404(Group, pk=group_pk) if group_pk else "" + if group_pk is not None and group_pk != "": + context['selected_group_pk'] = group_pk + context['selected_group'] = get_object_or_404(Group, pk=group_pk) if group_pk else "" + + position_pk = self.request.GET.get('position') + if position_pk is not None and position_pk != "": + context['selected_position_pk'] = position_pk + context['selected_position'] = get_object_or_404(Position, pk=position_pk) if position_pk else "" + + special_function_pk = self.request.GET.get('special_function') + if special_function_pk is not None and special_function_pk != "": + context['selected_special_function_pk'] = special_function_pk + context['selected_special_function'] = get_object_or_404(SpecialFunction, pk=special_function_pk) if special_function_pk else "" + return context diff --git a/mpicms/templates/personal/list.html b/mpicms/templates/personal/list.html index 50bd19b..0cab0cf 100644 --- a/mpicms/templates/personal/list.html +++ b/mpicms/templates/personal/list.html @@ -5,10 +5,12 @@

{% trans 'Contact List' %}