#101 Team enhancements
* visual enhancement for team index rendering * adds validity check for admin-membership of a team
This commit is contained in:
parent
e8fae7a6f4
commit
3e2c5b7e47
Binary file not shown.
@ -26,7 +26,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -64,6 +64,7 @@ msgstr "Verantwortliche Stelle"
|
|||||||
#: compensation/forms/forms.py:165 intervention/forms/forms.py:64
|
#: compensation/forms/forms.py:165 intervention/forms/forms.py:64
|
||||||
#: intervention/forms/forms.py:81 intervention/forms/forms.py:97
|
#: intervention/forms/forms.py:81 intervention/forms/forms.py:97
|
||||||
#: intervention/forms/forms.py:113 intervention/forms/modalForms.py:49
|
#: intervention/forms/forms.py:113 intervention/forms/modalForms.py:49
|
||||||
|
#: user/forms.py:196
|
||||||
msgid "Click for selection"
|
msgid "Click for selection"
|
||||||
msgstr "Auswählen..."
|
msgstr "Auswählen..."
|
||||||
|
|
||||||
@ -751,7 +752,7 @@ msgstr "Menge"
|
|||||||
#: intervention/templates/intervention/detail/includes/documents.html:39
|
#: intervention/templates/intervention/detail/includes/documents.html:39
|
||||||
#: intervention/templates/intervention/detail/includes/payments.html:39
|
#: intervention/templates/intervention/detail/includes/payments.html:39
|
||||||
#: intervention/templates/intervention/detail/includes/revocation.html:43
|
#: 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"
|
msgid "Action"
|
||||||
msgstr "Aktionen"
|
msgstr "Aktionen"
|
||||||
|
|
||||||
@ -1150,12 +1151,12 @@ msgstr "Kompensation {} bearbeitet"
|
|||||||
msgid "Edit {}"
|
msgid "Edit {}"
|
||||||
msgstr "Bearbeite {}"
|
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
|
#: ema/views.py:194 intervention/views.py:531
|
||||||
msgid "Log"
|
msgid "Log"
|
||||||
msgstr "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
|
#: ema/views.py:551 intervention/views.py:677
|
||||||
msgid "Report {}"
|
msgid "Report {}"
|
||||||
msgstr "Bericht {}"
|
msgstr "Bericht {}"
|
||||||
@ -1176,32 +1177,32 @@ msgstr "Ökokonto {} bearbeitet"
|
|||||||
msgid "Eco-account removed"
|
msgid "Eco-account removed"
|
||||||
msgstr "Ökokonto entfernt"
|
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
|
#: intervention/views.py:630
|
||||||
msgid "{} unrecorded"
|
msgid "{} unrecorded"
|
||||||
msgstr "{} entzeichnet"
|
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
|
#: intervention/views.py:630
|
||||||
msgid "{} recorded"
|
msgid "{} recorded"
|
||||||
msgstr "{} verzeichnet"
|
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
|
#: intervention/views.py:428
|
||||||
msgid "{} has already been shared with you"
|
msgid "{} has already been shared with you"
|
||||||
msgstr "{} wurde bereits für Sie freigegeben"
|
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
|
#: intervention/views.py:433
|
||||||
msgid "{} has been shared with you"
|
msgid "{} has been shared with you"
|
||||||
msgstr "{} ist nun für Sie freigegeben"
|
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
|
#: intervention/views.py:440
|
||||||
msgid "Share link invalid"
|
msgid "Share link invalid"
|
||||||
msgstr "Freigabelink ungültig"
|
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
|
#: intervention/views.py:463
|
||||||
msgid "Share settings updated"
|
msgid "Share settings updated"
|
||||||
msgstr "Freigabe Einstellungen aktualisiert"
|
msgstr "Freigabe Einstellungen aktualisiert"
|
||||||
@ -2272,7 +2273,7 @@ msgstr "* sind Pflichtfelder."
|
|||||||
msgid "New entry"
|
msgid "New entry"
|
||||||
msgstr "Neuer Eintrag"
|
msgstr "Neuer Eintrag"
|
||||||
|
|
||||||
#: templates/generic_index.html:41
|
#: templates/generic_index.html:41 user/templates/user/team/index.html:23
|
||||||
msgid "New"
|
msgid "New"
|
||||||
msgstr "Neu"
|
msgstr "Neu"
|
||||||
|
|
||||||
@ -2401,6 +2402,54 @@ msgstr "Neuen Token generieren"
|
|||||||
msgid "A new token needs to be validated by an administrator!"
|
msgid "A new token needs to be validated by an administrator!"
|
||||||
msgstr "Neue Tokens müssen durch Administratoren freigeschaltet werden!"
|
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
|
#: user/models/user_action.py:22
|
||||||
msgid "Unrecorded"
|
msgid "Unrecorded"
|
||||||
msgstr "Entzeichnet"
|
msgstr "Entzeichnet"
|
||||||
@ -2417,7 +2466,7 @@ msgstr "Gelöscht"
|
|||||||
msgid "Show contact data"
|
msgid "Show contact data"
|
||||||
msgstr "Zeige Kontaktdaten"
|
msgstr "Zeige Kontaktdaten"
|
||||||
|
|
||||||
#: user/templates/user/index.html:13
|
#: user/templates/user/index.html:13 user/templates/user/team/index.html:30
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -2462,6 +2511,27 @@ msgstr "API token einsehen oder neu generieren"
|
|||||||
msgid "API"
|
msgid "API"
|
||||||
msgstr ""
|
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
|
#: user/templates/user/token.html:6
|
||||||
msgid "API settings"
|
msgid "API settings"
|
||||||
msgstr "API Einstellungen"
|
msgstr "API Einstellungen"
|
||||||
@ -2486,26 +2556,38 @@ msgstr "Token noch nicht freigeschaltet"
|
|||||||
msgid "Valid until"
|
msgid "Valid until"
|
||||||
msgstr "Läuft ab am"
|
msgstr "Läuft ab am"
|
||||||
|
|
||||||
#: user/views.py:31
|
#: user/views.py:33
|
||||||
msgid "User settings"
|
msgid "User settings"
|
||||||
msgstr "Einstellungen"
|
msgstr "Einstellungen"
|
||||||
|
|
||||||
#: user/views.py:57
|
#: user/views.py:59
|
||||||
msgid "Notifications edited"
|
msgid "Notifications edited"
|
||||||
msgstr "Benachrichtigungen bearbeitet"
|
msgstr "Benachrichtigungen bearbeitet"
|
||||||
|
|
||||||
#: user/views.py:69
|
#: user/views.py:71
|
||||||
msgid "User notifications"
|
msgid "User notifications"
|
||||||
msgstr "Benachrichtigungen"
|
msgstr "Benachrichtigungen"
|
||||||
|
|
||||||
#: user/views.py:92
|
#: user/views.py:94
|
||||||
msgid "New token generated. Administrators need to validate."
|
msgid "New token generated. Administrators need to validate."
|
||||||
msgstr "Neuer Token generiert. Administratoren sind informiert."
|
msgstr "Neuer Token generiert. Administratoren sind informiert."
|
||||||
|
|
||||||
#: user/views.py:103
|
#: user/views.py:105
|
||||||
msgid "User API token"
|
msgid "User API token"
|
||||||
msgstr "API Nutzer 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/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/form_errors.html:3
|
||||||
#: venv/lib/python3.7/site-packages/bootstrap4/templates/bootstrap4/messages.html:4
|
#: venv/lib/python3.7/site-packages/bootstrap4/templates/bootstrap4/messages.html:4
|
||||||
|
@ -233,10 +233,27 @@ class EditTeamModalForm(NewTeamModalForm):
|
|||||||
empty_label=None,
|
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):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.form_title = _("Edit team")
|
self.form_title = _("Edit team")
|
||||||
self.form_caption = None
|
|
||||||
self.action_url = reverse("user:team-edit", args=(self.instance.id,))
|
self.action_url = reverse("user:team-edit", args=(self.instance.id,))
|
||||||
self.cancel_redirect = reverse("user:team-index")
|
self.cancel_redirect = reverse("user:team-index")
|
||||||
|
|
||||||
@ -255,6 +272,7 @@ class EditTeamModalForm(NewTeamModalForm):
|
|||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
self.instance.name = self.cleaned_data.get("name", None)
|
self.instance.name = self.cleaned_data.get("name", None)
|
||||||
self.instance.description = self.cleaned_data.get("description", None)
|
self.instance.description = self.cleaned_data.get("description", None)
|
||||||
|
self.instance.admin = self.cleaned_data.get("admin", None)
|
||||||
self.instance.save()
|
self.instance.save()
|
||||||
self.instance.users.set(self.cleaned_data.get("members", []))
|
self.instance.users.set(self.cleaned_data.get("members", []))
|
||||||
return self.instance
|
return self.instance
|
||||||
|
@ -13,51 +13,53 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h4>{% trans 'Teams' %}</h4>
|
<div class="container">
|
||||||
<div class="col-md">
|
<h4>{% trans 'Teams' %}</h4>
|
||||||
<button class="btn rlp-r btn-modal" data-form-url="{% url 'user:team-new' %}" title="{% trans 'Add new team' %}">
|
<div class="col-md">
|
||||||
{% fa5_icon 'plus' %}
|
<button class="btn rlp-r btn-modal" data-form-url="{% url 'user:team-new' %}" title="{% trans 'Add new team' %}">
|
||||||
{% trans 'New' %}
|
{% fa5_icon 'plus' %}
|
||||||
</button>
|
{% trans 'New' %}
|
||||||
</div>
|
</button>
|
||||||
<div class="table-container">
|
</div>
|
||||||
<table class="table table-hover">
|
<div class="table-container">
|
||||||
<thead>
|
<table class="table table-hover">
|
||||||
<tr>
|
<thead>
|
||||||
<th scope="col" class="align-middle">{% trans 'Name' %}</th>
|
|
||||||
<th scope="col" class="align-middle w-20">{% trans 'Description' %}</th>
|
|
||||||
<th scope="col" class="align-middle">{% trans 'Members' %}</th>
|
|
||||||
<th scope="col" class="align-middle">{% trans 'Actions' %}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for team in teams %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{team.name}}</td>
|
<th scope="col" class="align-middle">{% trans 'Name' %}</th>
|
||||||
<td>
|
<th scope="col" class="align-middle w-20">{% trans 'Description' %}</th>
|
||||||
<div class="scroll-150">
|
<th scope="col" class="align-middle">{% trans 'Members' %}</th>
|
||||||
{{team.description}}
|
<th scope="col" class="align-middle">{% trans 'Action' %}</th>
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% for member in team.users.all %}
|
|
||||||
<span class="badge badge-pill rlp-r">{{member.username}}</span>
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if team.admin == user %}
|
|
||||||
<button class="btn rlp-r btn-modal" data-form-url="{% url 'user:team-edit' team.id %}" title="{% trans 'Edit team' %}">
|
|
||||||
{% fa5_icon 'edit' %}
|
|
||||||
</button>
|
|
||||||
<button class="btn rlp-r btn-modal" data-form-url="{% url 'user:team-remove' team.id %}" title="{% trans 'Remove team' %}">
|
|
||||||
{% fa5_icon 'trash' %}
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
{% for team in teams %}
|
||||||
|
<tr>
|
||||||
|
<td>{{team.name}}</td>
|
||||||
|
<td>
|
||||||
|
<div class="scroll-150">
|
||||||
|
{{team.description}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% for member in team.users.all %}
|
||||||
|
<span class="badge badge-pill rlp-r">{{member.username}}</span>
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if team.admin == user %}
|
||||||
|
<button class="btn rlp-r btn-modal" data-form-url="{% url 'user:team-edit' team.id %}" title="{% trans 'Edit team' %}">
|
||||||
|
{% fa5_icon 'edit' %}
|
||||||
|
</button>
|
||||||
|
<button class="btn rlp-r btn-modal" data-form-url="{% url 'user:team-remove' team.id %}" title="{% trans 'Remove team' %}">
|
||||||
|
{% fa5_icon 'trash' %}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% with 'btn-modal' as btn_class %}
|
{% with 'btn-modal' as btn_class %}
|
||||||
|
Loading…
Reference in New Issue
Block a user