diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 022e9e1a..ca93bc88 100644 Binary files a/locale/de/LC_MESSAGES/django.mo and b/locale/de/LC_MESSAGES/django.mo differ diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 16b2cd4f..d1da918b 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-02-15 15:29+0100\n" +"POT-Creation-Date: 2022-02-17 13:42+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -64,6 +64,7 @@ msgstr "Verantwortliche Stelle" #: compensation/forms/forms.py:165 intervention/forms/forms.py:64 #: intervention/forms/forms.py:81 intervention/forms/forms.py:97 #: intervention/forms/forms.py:113 intervention/forms/modalForms.py:49 +#: user/forms.py:196 msgid "Click for selection" msgstr "Auswählen..." @@ -751,7 +752,7 @@ msgstr "Menge" #: intervention/templates/intervention/detail/includes/documents.html:39 #: intervention/templates/intervention/detail/includes/payments.html:39 #: intervention/templates/intervention/detail/includes/revocation.html:43 -#: templates/log.html:10 +#: templates/log.html:10 user/templates/user/team/index.html:33 msgid "Action" msgstr "Aktionen" @@ -1150,12 +1151,12 @@ msgstr "Kompensation {} bearbeitet" msgid "Edit {}" msgstr "Bearbeite {}" -#: compensation/views/compensation.py:240 compensation/views/eco_account.py:349 +#: compensation/views/compensation.py:240 compensation/views/eco_account.py:351 #: ema/views.py:194 intervention/views.py:531 msgid "Log" msgstr "Log" -#: compensation/views/compensation.py:584 compensation/views/eco_account.py:716 +#: compensation/views/compensation.py:584 compensation/views/eco_account.py:719 #: ema/views.py:551 intervention/views.py:677 msgid "Report {}" msgstr "Bericht {}" @@ -1176,32 +1177,32 @@ msgstr "Ökokonto {} bearbeitet" msgid "Eco-account removed" msgstr "Ökokonto entfernt" -#: compensation/views/eco_account.py:370 ema/views.py:275 +#: compensation/views/eco_account.py:372 ema/views.py:275 #: intervention/views.py:630 msgid "{} unrecorded" msgstr "{} entzeichnet" -#: compensation/views/eco_account.py:370 ema/views.py:275 +#: compensation/views/eco_account.py:372 ema/views.py:275 #: intervention/views.py:630 msgid "{} recorded" msgstr "{} verzeichnet" -#: compensation/views/eco_account.py:789 ema/views.py:617 +#: compensation/views/eco_account.py:792 ema/views.py:617 #: intervention/views.py:428 msgid "{} has already been shared with you" msgstr "{} wurde bereits für Sie freigegeben" -#: compensation/views/eco_account.py:794 ema/views.py:622 +#: compensation/views/eco_account.py:797 ema/views.py:622 #: intervention/views.py:433 msgid "{} has been shared with you" msgstr "{} ist nun für Sie freigegeben" -#: compensation/views/eco_account.py:801 ema/views.py:629 +#: compensation/views/eco_account.py:804 ema/views.py:629 #: intervention/views.py:440 msgid "Share link invalid" msgstr "Freigabelink ungültig" -#: compensation/views/eco_account.py:824 ema/views.py:652 +#: compensation/views/eco_account.py:827 ema/views.py:652 #: intervention/views.py:463 msgid "Share settings updated" msgstr "Freigabe Einstellungen aktualisiert" @@ -2272,7 +2273,7 @@ msgstr "* sind Pflichtfelder." msgid "New entry" msgstr "Neuer Eintrag" -#: templates/generic_index.html:41 +#: templates/generic_index.html:41 user/templates/user/team/index.html:23 msgid "New" msgstr "Neu" @@ -2401,6 +2402,54 @@ msgstr "Neuen Token generieren" msgid "A new token needs to be validated by an administrator!" msgstr "Neue Tokens müssen durch Administratoren freigeschaltet werden!" +#: user/forms.py:168 user/forms.py:172 +msgid "Team name" +msgstr "Team Name" + +#: user/forms.py:179 user/templates/user/team/index.html:31 +msgid "Description" +msgstr "Beschreibung" + +#: user/forms.py:188 +msgid "Manage team members" +msgstr "Mitglieder verwalten" + +#: user/forms.py:190 +msgid "" +"Multiple selection possible - You can only select users which are not " +"already a team member. Enter the full username or e-mail." +msgstr "" +"Mehrfachauswahl möglich - Sie können nur Nutzer wählen, die noch nicht " +"Mitglieder dieses Teams sind. Geben Sie den ganzen Nutzernamen an." + +#: user/forms.py:204 +msgid "Create new team" +msgstr "Neues Team anlegen" + +#: user/forms.py:205 +msgid "" +"You will become the administrator for this group by default. You do not need " +"to add yourself to the list of members." +msgstr "" +"Sie werden standardmäßig der Administrator dieses Teams. Sie müssen sich " +"selbst nicht zur Liste der Mitglieder hinzufügen." + +#: user/forms.py:230 +msgid "Admin" +msgstr "Administrator" + +#: user/forms.py:231 +msgid "Administrators manage team details and members" +msgstr "Administratoren verwalten die Teamdaten und Mitglieder" + +#: user/forms.py:244 +msgid "Selected admin ({}) needs to be a member of this team." +msgstr "Gewählter Administrator ({}) muss ein Mitglied des Teams sein." + +#: user/forms.py:256 user/templates/user/team/index.html:52 +msgid "Edit team" +msgstr "Team bearbeiten" + #: user/models/user_action.py:22 msgid "Unrecorded" msgstr "Entzeichnet" @@ -2417,7 +2466,7 @@ msgstr "Gelöscht" msgid "Show contact data" msgstr "Zeige Kontaktdaten" -#: user/templates/user/index.html:13 +#: user/templates/user/index.html:13 user/templates/user/team/index.html:30 msgid "Name" msgstr "" @@ -2462,6 +2511,27 @@ msgstr "API token einsehen oder neu generieren" msgid "API" msgstr "" +#: user/templates/user/index.html:66 +msgid "Manage teams" +msgstr "" + +#: user/templates/user/index.html:69 user/templates/user/team/index.html:19 +#: user/views.py:142 +msgid "Teams" +msgstr "" + +#: user/templates/user/team/index.html:21 +msgid "Add new team" +msgstr "Neues Team hinzufügen" + +#: user/templates/user/team/index.html:32 +msgid "Members" +msgstr "Mitglieder" + +#: user/templates/user/team/index.html:55 +msgid "Remove team" +msgstr "Team entfernen" + #: user/templates/user/token.html:6 msgid "API settings" msgstr "API Einstellungen" @@ -2486,26 +2556,38 @@ msgstr "Token noch nicht freigeschaltet" msgid "Valid until" msgstr "Läuft ab am" -#: user/views.py:31 +#: user/views.py:33 msgid "User settings" msgstr "Einstellungen" -#: user/views.py:57 +#: user/views.py:59 msgid "Notifications edited" msgstr "Benachrichtigungen bearbeitet" -#: user/views.py:69 +#: user/views.py:71 msgid "User notifications" msgstr "Benachrichtigungen" -#: user/views.py:92 +#: user/views.py:94 msgid "New token generated. Administrators need to validate." msgstr "Neuer Token generiert. Administratoren sind informiert." -#: user/views.py:103 +#: user/views.py:105 msgid "User API token" msgstr "API Nutzer Token" +#: user/views.py:153 +msgid "New team added" +msgstr "Neues Team hinzugefügt" + +#: user/views.py:166 +msgid "Team edited" +msgstr "Team bearbeitet" + +#: user/views.py:179 +msgid "Team removed" +msgstr "Team gelöscht" + #: venv/lib/python3.7/site-packages/bootstrap4/components.py:17 #: venv/lib/python3.7/site-packages/bootstrap4/templates/bootstrap4/form_errors.html:3 #: venv/lib/python3.7/site-packages/bootstrap4/templates/bootstrap4/messages.html:4 diff --git a/user/forms.py b/user/forms.py index 1b509bad..35c1e82e 100644 --- a/user/forms.py +++ b/user/forms.py @@ -233,10 +233,27 @@ class EditTeamModalForm(NewTeamModalForm): empty_label=None, ) + def __is_admin_valid(self): + admin = self.cleaned_data.get("admin", None) + members = self.cleaned_data.get("members", None) + _is_valid = admin in members + + if not _is_valid: + self.add_error( + "members", + _("Selected admin ({}) needs to be a member of this team.").format(admin.username) + ) + + return _is_valid + + def is_valid(self): + super_valid = super().is_valid() + admin_valid = self.__is_admin_valid() + return super_valid and admin_valid + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.form_title = _("Edit team") - self.form_caption = None self.action_url = reverse("user:team-edit", args=(self.instance.id,)) self.cancel_redirect = reverse("user:team-index") @@ -255,6 +272,7 @@ class EditTeamModalForm(NewTeamModalForm): with transaction.atomic(): self.instance.name = self.cleaned_data.get("name", None) self.instance.description = self.cleaned_data.get("description", None) + self.instance.admin = self.cleaned_data.get("admin", None) self.instance.save() self.instance.users.set(self.cleaned_data.get("members", [])) return self.instance diff --git a/user/templates/user/team/index.html b/user/templates/user/team/index.html index c8ce113d..d2040a35 100644 --- a/user/templates/user/team/index.html +++ b/user/templates/user/team/index.html @@ -13,51 +13,53 @@ {% endblock %} {% block body %} -

{% trans 'Teams' %}

-
- -
-
- - - - - - - - - - - {% for team in teams %} +
+

{% trans 'Teams' %}

+
+ +
+
+
{% trans 'Name' %}{% trans 'Description' %}{% trans 'Members' %}{% trans 'Actions' %}
+ - - - - + + + + - {% endfor %} - -
{{team.name}} -
- {{team.description}} -
-
- {% for member in team.users.all %} - {{member.username}} - {% endfor %} - - {% if team.admin == user %} - - - {% endif %} - {% trans 'Name' %}{% trans 'Description' %}{% trans 'Members' %}{% trans 'Action' %}
+ + + {% for team in teams %} + + {{team.name}} + +
+ {{team.description}} +
+ + + {% for member in team.users.all %} + {{member.username}} + {% endfor %} + + + {% if team.admin == user %} + + + {% endif %} + + + {% endfor %} + + +
{% with 'btn-modal' as btn_class %}