User contact modal

* adds user/includes/contact_modal_button.html for calling contact data of a user
* adds user contact modal to intervention detail view
* adds translations
This commit is contained in:
mipel 2021-08-02 14:10:57 +02:00
parent 6e2ee15b93
commit c72ff615ba
7 changed files with 205 additions and 90 deletions

View File

@ -129,8 +129,9 @@
<td class="align-middle"> <td class="align-middle">
{{intervention.created.timestamp|default_if_none:""|naturalday}} {{intervention.created.timestamp|default_if_none:""|naturalday}}
<br> <br>
{% trans 'by' %} {% with intervention.created.user as user %}
{{intervention.created.user|default_if_none:""}} {% include 'user/includes/contact_modal_button.html' %}
{% endwith %}
</td> </td>
</tr> </tr>
</table> </table>

Binary file not shown.

View File

@ -3,17 +3,17 @@
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# #
#: compensation/forms.py:27 compensation/forms.py:32 compensation/forms.py:45 #: compensation/forms.py:29 compensation/forms.py:34 compensation/forms.py:47
#: intervention/filters.py:26 intervention/filters.py:40 #: intervention/filters.py:26 intervention/filters.py:40
#: intervention/filters.py:47 intervention/filters.py:48 konova/forms.py:78 #: intervention/filters.py:47 intervention/filters.py:48 konova/forms.py:85
#: konova/forms.py:155 konova/forms.py:182 konova/forms.py:187 #: konova/forms.py:177 konova/forms.py:247 konova/forms.py:252
#: konova/forms.py:199 konova/forms.py:210 konova/forms.py:223 user/forms.py:38 #: konova/forms.py:264 konova/forms.py:275 konova/forms.py:288 user/forms.py:38
#, fuzzy #, fuzzy
msgid "" 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: 2021-08-02 09:52+0200\n" "POT-Creation-Date: 2021-08-02 14:06+0200\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"
@ -23,51 +23,51 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: compensation/forms.py:26 #: compensation/forms.py:28
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:31 #: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:31
msgid "Amount" msgid "Amount"
msgstr "Menge" msgstr "Menge"
#: compensation/forms.py:28 #: compensation/forms.py:30
msgid "Amount in Euro" msgid "Amount in Euro"
msgstr "Betrag in Euro" msgstr "Betrag in Euro"
#: compensation/forms.py:31 #: compensation/forms.py:33
#: intervention/templates/intervention/detail/includes/payments.html:29 #: intervention/templates/intervention/detail/includes/payments.html:29
msgid "Due on" msgid "Due on"
msgstr "Fällig am" msgstr "Fällig am"
#: compensation/forms.py:33 #: compensation/forms.py:35
msgid "Due on which date" msgid "Due on which date"
msgstr "Zahlung wird an diesem Datum erwartet" msgstr "Zahlung wird an diesem Datum erwartet"
#: compensation/forms.py:46 #: compensation/forms.py:48
msgid "Transfer note" msgid "Transfer note"
msgstr "Verwendungszweck" msgstr "Verwendungszweck"
#: compensation/forms.py:47 #: compensation/forms.py:49
msgid "Note for money transfer" msgid "Note for money transfer"
msgstr "Verwendungszweck für Überweisung" msgstr "Verwendungszweck für Überweisung"
#: compensation/forms.py:54 #: compensation/forms.py:56
msgid "Payment" msgid "Payment"
msgstr "Zahlung" msgstr "Zahlung"
#: compensation/forms.py:55 #: compensation/forms.py:57
msgid "Add a payment for intervention '{}'" msgid "Add a payment for intervention '{}'"
msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen" msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen"
#: compensation/tables.py:24 compensation/tables.py:164 #: compensation/tables.py:24 compensation/tables.py:164
#: intervention/forms.py:26 intervention/tables.py:23 #: intervention/forms.py:28 intervention/tables.py:23
#: intervention/templates/intervention/detail/includes/compensations.html:28 #: intervention/templates/intervention/detail/includes/compensations.html:28
msgid "Identifier" msgid "Identifier"
msgstr "Kennung" msgstr "Kennung"
#: compensation/tables.py:29 compensation/tables.py:169 #: compensation/tables.py:29 compensation/tables.py:169
#: intervention/forms.py:33 intervention/tables.py:28 #: intervention/forms.py:35 intervention/tables.py:28
#: intervention/templates/intervention/detail/includes/compensations.html:31 #: intervention/templates/intervention/detail/includes/compensations.html:31
#: intervention/templates/intervention/detail/includes/documents.html:26 #: intervention/templates/intervention/detail/includes/documents.html:26
#: intervention/templates/intervention/detail/view.html:60 konova/forms.py:181 #: intervention/templates/intervention/detail/view.html:60 konova/forms.py:246
msgid "Title" msgid "Title"
msgstr "Bezeichnung" msgstr "Bezeichnung"
@ -128,7 +128,7 @@ msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
msgid "Access not granted" msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar" msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: compensation/tables.py:174 konova/forms.py:186 #: compensation/tables.py:174 konova/forms.py:251
msgid "Created on" msgid "Created on"
msgstr "Erstellt" msgstr "Erstellt"
@ -148,19 +148,22 @@ msgstr "Bearbeite {}"
msgid "Delete {}" msgid "Delete {}"
msgstr "Lösche {}" msgstr "Lösche {}"
#: compensation/views.py:136 #: compensation/views.py:77
msgid "Compensation removed"
msgstr "Kompensation entfernt"
#: compensation/views.py:151
msgid "Payment added" msgid "Payment added"
msgstr "Zahlung hinzugefügt" msgstr "Zahlung hinzugefügt"
#: compensation/views.py:142 compensation/views.py:180 #: compensation/views.py:185
#: intervention/views.py:101 konova/views.py:153
msgid "There was an error on this form."
msgstr "Es gab einen Fehler im Formular."
#: compensation/views.py:174
msgid "Payment removed" msgid "Payment removed"
msgstr "Zahlung gelöscht" msgstr "Zahlung gelöscht"
#: compensation/views.py:210
msgid "Withdraw removed"
msgstr "Abbuchung entfernt"
#: intervention/filters.py:25 #: intervention/filters.py:25
msgid "Show unshared" msgid "Show unshared"
msgstr "Nicht freigegebene anzeigen" msgstr "Nicht freigegebene anzeigen"
@ -177,98 +180,98 @@ msgstr "Gemarkung"
msgid "Search for district" msgid "Search for district"
msgstr "Nach Gemarkung suchen" msgstr "Nach Gemarkung suchen"
#: intervention/forms.py:29 #: intervention/forms.py:31
msgid "Generated automatically if none was given" msgid "Generated automatically if none was given"
msgstr "Wird automatisch erzeugt, falls nicht angegeben" msgstr "Wird automatisch erzeugt, falls nicht angegeben"
#: intervention/forms.py:38 #: intervention/forms.py:40
msgid "Type" msgid "Type"
msgstr "Typ" msgstr "Typ"
#: intervention/forms.py:41 #: intervention/forms.py:43
msgid "Which intervention type is this" msgid "Which intervention type is this"
msgstr "Welcher Eingriffstyp" msgstr "Welcher Eingriffstyp"
#: intervention/forms.py:44 #: intervention/forms.py:46
#: intervention/templates/intervention/detail/view.html:68 #: intervention/templates/intervention/detail/view.html:68
msgid "Law" msgid "Law"
msgstr "Gesetz" msgstr "Gesetz"
#: intervention/forms.py:47 #: intervention/forms.py:49
msgid "Based on which law" msgid "Based on which law"
msgstr "Basiert auf welchem Recht" msgstr "Basiert auf welchem Recht"
#: intervention/forms.py:50 #: intervention/forms.py:52
#: intervention/templates/intervention/detail/view.html:88 #: intervention/templates/intervention/detail/view.html:88
msgid "Intervention handler" msgid "Intervention handler"
msgstr "Eingriffsverursacher" msgstr "Eingriffsverursacher"
#: intervention/forms.py:53 #: intervention/forms.py:55
msgid "Who performs the intervention" msgid "Who performs the intervention"
msgstr "Wer führt den Eingriff durch" msgstr "Wer führt den Eingriff durch"
#: intervention/forms.py:56 #: intervention/forms.py:58
msgid "Data provider" msgid "Data provider"
msgstr "Datenbereitsteller" msgstr "Datenbereitsteller"
#: intervention/forms.py:58 #: intervention/forms.py:60
msgid "Who provides the data for the intervention" msgid "Who provides the data for the intervention"
msgstr "Wer stellt die Daten für den Eingriff zur Verfügung" msgstr "Wer stellt die Daten für den Eingriff zur Verfügung"
#: intervention/forms.py:63 #: intervention/forms.py:65
msgid "Organization" msgid "Organization"
msgstr "Organisation" msgstr "Organisation"
#: intervention/forms.py:69 #: intervention/forms.py:71
msgid "Data provider details" msgid "Data provider details"
msgstr "Datenbereitsteller Details" msgstr "Datenbereitsteller Details"
#: intervention/forms.py:72 #: intervention/forms.py:74
msgid "Further details" msgid "Further details"
msgstr "Weitere Details" msgstr "Weitere Details"
#: intervention/forms.py:85 #: intervention/forms.py:87
msgid "Map" msgid "Map"
msgstr "Karte" msgstr "Karte"
#: intervention/forms.py:87 #: intervention/forms.py:89
msgid "Where does the intervention take place" msgid "Where does the intervention take place"
msgstr "Wo findet der Eingriff statt" msgstr "Wo findet der Eingriff statt"
#: intervention/forms.py:95 #: intervention/forms.py:97
msgid "Files" msgid "Files"
msgstr "Dateien" msgstr "Dateien"
#: intervention/forms.py:102 #: intervention/forms.py:104
msgid "New intervention" msgid "New intervention"
msgstr "Neuer Eingriff" msgstr "Neuer Eingriff"
#: intervention/forms.py:145 #: intervention/forms.py:151
msgid "Edit intervention" msgid "Edit intervention"
msgstr "Eingriff bearbeiten" msgstr "Eingriff bearbeiten"
#: intervention/forms.py:239 #: intervention/forms.py:245
msgid "Share link" msgid "Share link"
msgstr "Freigabelink" msgstr "Freigabelink"
#: intervention/forms.py:241 #: intervention/forms.py:247
msgid "Send this link to users who you want to have writing access on the data" msgid "Send this link to users who you want to have writing access on the data"
msgstr "Andere Nutzer erhalten über diesen Link Zugriff auf die Daten" msgstr "Andere Nutzer erhalten über diesen Link Zugriff auf die Daten"
#: intervention/forms.py:250 #: intervention/forms.py:256
msgid "Shared with" msgid "Shared with"
msgstr "Freigegeben für" msgstr "Freigegeben für"
#: intervention/forms.py:253 #: intervention/forms.py:259
msgid "Remove check to remove access for this user" msgid "Remove check to remove access for this user"
msgstr "Wählen Sie die Nutzer ab, die keinen Zugriff mehr haben sollen" msgstr "Wählen Sie die Nutzer ab, die keinen Zugriff mehr haben sollen"
#: intervention/forms.py:264 #: intervention/forms.py:270
#: intervention/templates/intervention/detail/view.html:27 #: intervention/templates/intervention/detail/view.html:27
msgid "Share" msgid "Share"
msgstr "Freigabe" msgstr "Freigabe"
#: intervention/forms.py:265 #: intervention/forms.py:271
msgid "Share settings for {}" msgid "Share settings for {}"
msgstr "Freigabe Einstellungen für {}" msgstr "Freigabe Einstellungen für {}"
@ -283,29 +286,34 @@ msgid "Intervention"
msgstr "Eingriff" msgstr "Eingriff"
#: intervention/templates/intervention/detail/includes/compensations.html:13 #: intervention/templates/intervention/detail/includes/compensations.html:13
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:13
msgid "Add new compensation" msgid "Add new compensation"
msgstr "Neue Kompensation hinzufügen" msgstr "Neue Kompensation hinzufügen"
#: intervention/templates/intervention/detail/includes/compensations.html:34
#: intervention/templates/intervention/detail/includes/documents.html:32
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:34
#: intervention/templates/intervention/detail/includes/payments.html:35
msgid "Action"
msgstr "Aktionen"
#: intervention/templates/intervention/detail/includes/compensations.html:48
msgid "Remove compensation"
msgstr "Kompensation entfernen"
#: intervention/templates/intervention/detail/includes/documents.html:8 #: intervention/templates/intervention/detail/includes/documents.html:8
msgid "Documents" msgid "Documents"
msgstr "Dokumente" msgstr "Dokumente"
#: intervention/templates/intervention/detail/includes/documents.html:13 #: intervention/templates/intervention/detail/includes/documents.html:13
#: konova/forms.py:222 #: konova/forms.py:287
msgid "Add new document" msgid "Add new document"
msgstr "Neues Dokument hinzufügen" msgstr "Neues Dokument hinzufügen"
#: intervention/templates/intervention/detail/includes/documents.html:29 #: intervention/templates/intervention/detail/includes/documents.html:29
#: konova/forms.py:209 #: konova/forms.py:274
msgid "Comment" msgid "Comment"
msgstr "Kommentar" msgstr "Kommentar"
#: intervention/templates/intervention/detail/includes/documents.html:32
#: intervention/templates/intervention/detail/includes/payments.html:35
msgid "Action"
msgstr "Aktionen"
#: intervention/templates/intervention/detail/includes/documents.html:46 #: intervention/templates/intervention/detail/includes/documents.html:46
msgid "Remove document" msgid "Remove document"
msgstr "Dokument löschen" msgstr "Dokument löschen"
@ -314,10 +322,18 @@ msgstr "Dokument löschen"
msgid "Eco Account Withdraws" msgid "Eco Account Withdraws"
msgstr "Ökokonto Abbuchungen" msgstr "Ökokonto Abbuchungen"
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:13
msgid "Add new withdraw"
msgstr ""
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:28 #: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:28
msgid "Account Identifier" msgid "Account Identifier"
msgstr "Ökokonto Kennung" msgstr "Ökokonto Kennung"
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:48
msgid "Remove Withdraw"
msgstr "Abbuchung entfernen"
#: intervention/templates/intervention/detail/includes/payments.html:8 #: intervention/templates/intervention/detail/includes/payments.html:8
msgid "Payments" msgid "Payments"
msgstr "Ersatzzahlungen" msgstr "Ersatzzahlungen"
@ -390,7 +406,6 @@ msgstr "Geprüft am "
#: intervention/templates/intervention/detail/view.html:99 #: intervention/templates/intervention/detail/view.html:99
#: intervention/templates/intervention/detail/view.html:113 #: intervention/templates/intervention/detail/view.html:113
#: intervention/templates/intervention/detail/view.html:132
msgid "by" msgid "by"
msgstr "von" msgstr "von"
@ -410,23 +425,23 @@ msgstr "Datum Bestandskraft"
msgid "Last modified" msgid "Last modified"
msgstr "Zuletzt bearbeitet" msgstr "Zuletzt bearbeitet"
#: intervention/templates/intervention/detail/view.html:141 #: intervention/templates/intervention/detail/view.html:142
msgid "No geometry added, yet." msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden" msgstr "Keine Geometrie vorhanden"
#: intervention/views.py:62 #: intervention/views.py:63
msgid "Intervention {} added" msgid "Intervention {} added"
msgstr "Eingriff {} hinzugefügt" msgstr "Eingriff {} hinzugefügt"
#: intervention/views.py:65 intervention/views.py:166 #: intervention/views.py:66 intervention/views.py:173
msgid "Invalid input" msgid "Invalid input"
msgstr "Eingabe fehlerhaft" msgstr "Eingabe fehlerhaft"
#: intervention/views.py:94 #: intervention/views.py:95
msgid "Document '{}' added" msgid "Document '{}' added"
msgstr "Dokument '{}' hinzugefügt" msgstr "Dokument '{}' hinzugefügt"
#: intervention/views.py:140 #: intervention/views.py:147
msgid "" msgid ""
"Remember: This data has not been shared with you, yet. This means you can " "Remember: This data has not been shared with you, yet. This means you can "
"only read but can not edit or perform any actions like running a check or " "only read but can not edit or perform any actions like running a check or "
@ -436,23 +451,23 @@ msgstr ""
"bedeutet, dass Sie nur lesenden Zugriff hierauf haben und weder bearbeiten, " "bedeutet, dass Sie nur lesenden Zugriff hierauf haben und weder bearbeiten, "
"noch Prüfungen durchführen oder verzeichnen können." "noch Prüfungen durchführen oder verzeichnen können."
#: intervention/views.py:163 #: intervention/views.py:170
msgid "{} edited" msgid "{} edited"
msgstr "{} bearbeitet" msgstr "{} bearbeitet"
#: intervention/views.py:225 #: intervention/views.py:232
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"
#: intervention/views.py:230 #: intervention/views.py:237
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"
#: intervention/views.py:237 #: intervention/views.py:244
msgid "Share link invalid" msgid "Share link invalid"
msgstr "Freigabelink ungültig" msgstr "Freigabelink ungültig"
#: intervention/views.py:262 #: intervention/views.py:269
msgid "Share settings updated" msgid "Share settings updated"
msgstr "Freigabe Einstellungen aktualisiert" msgstr "Freigabe Einstellungen aktualisiert"
@ -468,40 +483,44 @@ msgstr "Hierfür müssen Sie Administrator sein!"
msgid "You need to be part of another user group." msgid "You need to be part of another user group."
msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!" msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!"
#: konova/forms.py:51 #: konova/forms.py:58
msgid "Not editable" msgid "Not editable"
msgstr "Nicht editierbar" msgstr "Nicht editierbar"
#: konova/forms.py:77 konova/forms.py:154 #: konova/forms.py:84 konova/forms.py:176
msgid "Confirm" msgid "Confirm"
msgstr "Bestätige" msgstr "Bestätige"
#: konova/forms.py:89 konova/forms.py:163 #: konova/forms.py:96 konova/forms.py:185
msgid "Remove" msgid "Remove"
msgstr "Löschen" msgstr "Löschen"
#: konova/forms.py:91 #: konova/forms.py:98
msgid "You are about to remove {} {}" msgid "You are about to remove {} {}"
msgstr "Sie sind dabei {} {} zu löschen" msgstr "Sie sind dabei {} {} zu löschen"
#: konova/forms.py:164 #: konova/forms.py:186
msgid "Are you sure?" msgid "Are you sure?"
msgstr "Sind Sie sicher?" msgstr "Sind Sie sicher?"
#: konova/forms.py:188 #: konova/forms.py:203
msgid "Object removed"
msgstr "Objekt entfernt"
#: konova/forms.py:253
msgid "When has this file been created? Important for photos." msgid "When has this file been created? Important for photos."
msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?" msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?"
#: konova/forms.py:198 #: konova/forms.py:263
#: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231 #: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231
msgid "File" msgid "File"
msgstr "Datei" msgstr "Datei"
#: konova/forms.py:200 #: konova/forms.py:265
msgid "Must be smaller than 15 Mb" msgid "Must be smaller than 15 Mb"
msgstr "Muss kleiner als 15 Mb sein" msgstr "Muss kleiner als 15 Mb sein"
#: konova/forms.py:211 #: konova/forms.py:276
msgid "Additional comment on this file" msgid "Additional comment on this file"
msgstr "Zusätzlicher Kommentar" msgstr "Zusätzlicher Kommentar"
@ -565,7 +584,11 @@ msgstr "Ökokonto"
msgid "Withdraw" msgid "Withdraw"
msgstr "Abbuchen" msgstr "Abbuchen"
#: konova/views.py:147 #: konova/utils/message_templates.py:11
msgid "There was an error on this form."
msgstr "Es gab einen Fehler im Formular."
#: konova/views.py:140
msgid "Document '{}' deleted" msgid "Document '{}' deleted"
msgstr "Dokument '{}' gelöscht" msgstr "Dokument '{}' gelöscht"
@ -697,16 +720,28 @@ msgstr "Wann wollen Sie per E-Mail benachrichtigt werden?"
msgid "Edit notifications" msgid "Edit notifications"
msgstr "Benachrichtigungen bearbeiten" msgstr "Benachrichtigungen bearbeiten"
#: user/templates/user/index.html:9 #: user/forms.py:76 user/templates/user/index.html:9
msgid "Username" msgid "Username"
msgstr "Nutzername" msgstr "Nutzername"
#: user/templates/user/index.html:13 #: user/forms.py:87
msgid "Name" msgid "Person name"
msgstr "Name"
#: user/forms.py:98 user/templates/user/index.html:17
msgid "E-Mail"
msgstr "" msgstr ""
#: user/templates/user/index.html:17 #: user/forms.py:112
msgid "E-Mail" msgid "User contact data"
msgstr "Kontaktdaten"
#: user/templates/user/includes/contact_modal_button.html:3
msgid "Show contact data"
msgstr "Zeige Kontaktdaten"
#: user/templates/user/index.html:13
msgid "Name"
msgstr "" msgstr ""
#: user/templates/user/index.html:21 #: user/templates/user/index.html:21
@ -742,7 +777,7 @@ msgstr "Benachrichtigungseinstellungen ändern"
msgid "Notification settings" msgid "Notification settings"
msgstr "Benachrichtigungen" msgstr "Benachrichtigungen"
#: user/views.py:52 #: user/views.py:53
msgid "Notifications edited" msgid "Notifications edited"
msgstr "Benachrichtigungen bearbeitet" msgstr "Benachrichtigungen bearbeitet"
@ -2005,9 +2040,6 @@ msgstr ""
#~ msgid "Show compensation" #~ msgid "Show compensation"
#~ msgstr "Zeige Kompensationen" #~ msgstr "Zeige Kompensationen"
#~ msgid "New compensation"
#~ msgstr "Neue Kompensation"
#~ msgid "Eco-account management" #~ msgid "Eco-account management"
#~ msgstr "Ökokontoverwaltung" #~ msgstr "Ökokontoverwaltung"

View File

@ -10,7 +10,7 @@ from django.urls import reverse
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import User from django.contrib.auth.models import User
from konova.forms import BaseForm from konova.forms import BaseForm, BaseModalForm
from user.models import UserNotification, KonovaUserExtension from user.models import UserNotification, KonovaUserExtension
@ -69,3 +69,51 @@ class UserNotificationForm(BaseForm):
id__in=selected_notification_ids, id__in=selected_notification_ids,
) )
self.konova_extension.notifications.set(notifications) self.konova_extension.notifications.set(notifications)
class UserContactForm(BaseModalForm):
name = forms.CharField(
label=_("Username"),
label_suffix="",
required=False,
widget=forms.TextInput(
attrs={
"readonly": True,
"style": "width:100%",
}
),
)
person_name = forms.CharField(
label=_("Person name"),
label_suffix="",
required=False,
widget=forms.TextInput(
attrs={
"readonly": True,
"style": "width:100%",
}
),
)
mail = forms.EmailField(
label=_("E-Mail"),
label_suffix="",
required=False,
widget=forms.TextInput(
attrs={
"readonly": True,
"style": "width:100%",
}
),
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.render_submit = False
self.form_title = _("User contact data")
self.form_caption = ""
self.initialize_form_field("name", self.instance.username)
self.initialize_form_field("person_name", "{} {}".format(self.instance.first_name, self.instance.last_name))
self.initialize_form_field("mail", self.instance.email)

View File

@ -0,0 +1,6 @@
{% load fontawesome_5 i18n %}
<button class="btn btn-default btn-modal" data-form-url="{% url 'user:contact' user.id %}" title="{% trans 'Show contact data' %}">
{% fa5_icon 'id-card' %}
<span>{{user.username}}</span>
</button>

View File

@ -13,4 +13,6 @@ app_name = "user"
urlpatterns = [ urlpatterns = [
path("", index_view, name="index"), path("", index_view, name="index"),
path("notifications/", notifications_view, name="notifications"), path("notifications/", notifications_view, name="notifications"),
path("contact/<id>", contact_view, name="contact"),
] ]

View File

@ -1,11 +1,12 @@
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpRequest from django.http import HttpRequest
from django.shortcuts import render, redirect from django.shortcuts import render, redirect, get_object_or_404
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from konova.contexts import BaseContext from konova.contexts import BaseContext
from user.forms import UserNotificationForm from user.forms import UserNotificationForm, UserContactForm
from user.models import KonovaUserExtension from user.models import KonovaUserExtension
@ -65,3 +66,28 @@ def notifications_view(request: HttpRequest):
} }
context = BaseContext(request, context).context context = BaseContext(request, context).context
return render(request, template, context) return render(request, template, context)
@login_required
def contact_view(request: HttpRequest, id: str):
""" Renders contact modal view of a users contact data
Args:
request (HttpRequest): The incoming request
id (str): The user's id
Returns:
"""
user = get_object_or_404(User, id=id)
form = UserContactForm(request.POST or None, instance=user, user=request.user)
template = "modal/modal_form.html"
context = {
"form": form,
}
context = BaseContext(request, context).context
return render(
request,
template,
context
)