diff --git a/intervention/templates/intervention/detail/view.html b/intervention/templates/intervention/detail/view.html index 2ade6d7a..1a20a623 100644 --- a/intervention/templates/intervention/detail/view.html +++ b/intervention/templates/intervention/detail/view.html @@ -129,8 +129,9 @@ {{intervention.created.timestamp|default_if_none:""|naturalday}}
- {% trans 'by' %} - {{intervention.created.user|default_if_none:""}} + {% with intervention.created.user as user %} + {% include 'user/includes/contact_modal_button.html' %} + {% endwith %} diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 90c3fce3..cd137879 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 a140667d..09b1bba1 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -3,17 +3,17 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , 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:47 intervention/filters.py:48 konova/forms.py:78 -#: konova/forms.py:155 konova/forms.py:182 konova/forms.py:187 -#: konova/forms.py:199 konova/forms.py:210 konova/forms.py:223 user/forms.py:38 +#: intervention/filters.py:47 intervention/filters.py:48 konova/forms.py:85 +#: konova/forms.py:177 konova/forms.py:247 konova/forms.py:252 +#: konova/forms.py:264 konova/forms.py:275 konova/forms.py:288 user/forms.py:38 #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\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" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -23,51 +23,51 @@ msgstr "" "Content-Transfer-Encoding: 8bit\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 msgid "Amount" msgstr "Menge" -#: compensation/forms.py:28 +#: compensation/forms.py:30 msgid "Amount in Euro" msgstr "Betrag in Euro" -#: compensation/forms.py:31 +#: compensation/forms.py:33 #: intervention/templates/intervention/detail/includes/payments.html:29 msgid "Due on" msgstr "Fällig am" -#: compensation/forms.py:33 +#: compensation/forms.py:35 msgid "Due on which date" msgstr "Zahlung wird an diesem Datum erwartet" -#: compensation/forms.py:46 +#: compensation/forms.py:48 msgid "Transfer note" msgstr "Verwendungszweck" -#: compensation/forms.py:47 +#: compensation/forms.py:49 msgid "Note for money transfer" msgstr "Verwendungszweck für Überweisung" -#: compensation/forms.py:54 +#: compensation/forms.py:56 msgid "Payment" msgstr "Zahlung" -#: compensation/forms.py:55 +#: compensation/forms.py:57 msgid "Add a payment for intervention '{}'" msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen" #: 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 msgid "Identifier" msgstr "Kennung" #: 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/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" msgstr "Bezeichnung" @@ -128,7 +128,7 @@ msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden" msgid "Access not granted" 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" msgstr "Erstellt" @@ -148,19 +148,22 @@ msgstr "Bearbeite {}" msgid "Delete {}" msgstr "Lösche {}" -#: compensation/views.py:136 +#: compensation/views.py:77 +msgid "Compensation removed" +msgstr "Kompensation entfernt" + +#: compensation/views.py:151 msgid "Payment added" msgstr "Zahlung hinzugefügt" -#: compensation/views.py:142 compensation/views.py:180 -#: 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 +#: compensation/views.py:185 msgid "Payment removed" msgstr "Zahlung gelöscht" +#: compensation/views.py:210 +msgid "Withdraw removed" +msgstr "Abbuchung entfernt" + #: intervention/filters.py:25 msgid "Show unshared" msgstr "Nicht freigegebene anzeigen" @@ -177,98 +180,98 @@ msgstr "Gemarkung" msgid "Search for district" msgstr "Nach Gemarkung suchen" -#: intervention/forms.py:29 +#: intervention/forms.py:31 msgid "Generated automatically if none was given" msgstr "Wird automatisch erzeugt, falls nicht angegeben" -#: intervention/forms.py:38 +#: intervention/forms.py:40 msgid "Type" msgstr "Typ" -#: intervention/forms.py:41 +#: intervention/forms.py:43 msgid "Which intervention type is this" msgstr "Welcher Eingriffstyp" -#: intervention/forms.py:44 +#: intervention/forms.py:46 #: intervention/templates/intervention/detail/view.html:68 msgid "Law" msgstr "Gesetz" -#: intervention/forms.py:47 +#: intervention/forms.py:49 msgid "Based on which law" msgstr "Basiert auf welchem Recht" -#: intervention/forms.py:50 +#: intervention/forms.py:52 #: intervention/templates/intervention/detail/view.html:88 msgid "Intervention handler" msgstr "Eingriffsverursacher" -#: intervention/forms.py:53 +#: intervention/forms.py:55 msgid "Who performs the intervention" msgstr "Wer führt den Eingriff durch" -#: intervention/forms.py:56 +#: intervention/forms.py:58 msgid "Data provider" msgstr "Datenbereitsteller" -#: intervention/forms.py:58 +#: intervention/forms.py:60 msgid "Who provides the data for the intervention" msgstr "Wer stellt die Daten für den Eingriff zur Verfügung" -#: intervention/forms.py:63 +#: intervention/forms.py:65 msgid "Organization" msgstr "Organisation" -#: intervention/forms.py:69 +#: intervention/forms.py:71 msgid "Data provider details" msgstr "Datenbereitsteller Details" -#: intervention/forms.py:72 +#: intervention/forms.py:74 msgid "Further details" msgstr "Weitere Details" -#: intervention/forms.py:85 +#: intervention/forms.py:87 msgid "Map" msgstr "Karte" -#: intervention/forms.py:87 +#: intervention/forms.py:89 msgid "Where does the intervention take place" msgstr "Wo findet der Eingriff statt" -#: intervention/forms.py:95 +#: intervention/forms.py:97 msgid "Files" msgstr "Dateien" -#: intervention/forms.py:102 +#: intervention/forms.py:104 msgid "New intervention" msgstr "Neuer Eingriff" -#: intervention/forms.py:145 +#: intervention/forms.py:151 msgid "Edit intervention" msgstr "Eingriff bearbeiten" -#: intervention/forms.py:239 +#: intervention/forms.py:245 msgid "Share link" 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" msgstr "Andere Nutzer erhalten über diesen Link Zugriff auf die Daten" -#: intervention/forms.py:250 +#: intervention/forms.py:256 msgid "Shared with" msgstr "Freigegeben für" -#: intervention/forms.py:253 +#: intervention/forms.py:259 msgid "Remove check to remove access for this user" 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 msgid "Share" msgstr "Freigabe" -#: intervention/forms.py:265 +#: intervention/forms.py:271 msgid "Share settings for {}" msgstr "Freigabe Einstellungen für {}" @@ -283,29 +286,34 @@ msgid "Intervention" msgstr "Eingriff" #: intervention/templates/intervention/detail/includes/compensations.html:13 -#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:13 msgid "Add new compensation" 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 msgid "Documents" msgstr "Dokumente" #: intervention/templates/intervention/detail/includes/documents.html:13 -#: konova/forms.py:222 +#: konova/forms.py:287 msgid "Add new document" msgstr "Neues Dokument hinzufügen" #: intervention/templates/intervention/detail/includes/documents.html:29 -#: konova/forms.py:209 +#: konova/forms.py:274 msgid "Comment" 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 msgid "Remove document" msgstr "Dokument löschen" @@ -314,10 +322,18 @@ msgstr "Dokument löschen" msgid "Eco Account Withdraws" 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 msgid "Account Identifier" 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 msgid "Payments" msgstr "Ersatzzahlungen" @@ -390,7 +406,6 @@ msgstr "Geprüft am " #: intervention/templates/intervention/detail/view.html:99 #: intervention/templates/intervention/detail/view.html:113 -#: intervention/templates/intervention/detail/view.html:132 msgid "by" msgstr "von" @@ -410,23 +425,23 @@ msgstr "Datum Bestandskraft" msgid "Last modified" msgstr "Zuletzt bearbeitet" -#: intervention/templates/intervention/detail/view.html:141 +#: intervention/templates/intervention/detail/view.html:142 msgid "No geometry added, yet." msgstr "Keine Geometrie vorhanden" -#: intervention/views.py:62 +#: intervention/views.py:63 msgid "Intervention {} added" msgstr "Eingriff {} hinzugefügt" -#: intervention/views.py:65 intervention/views.py:166 +#: intervention/views.py:66 intervention/views.py:173 msgid "Invalid input" msgstr "Eingabe fehlerhaft" -#: intervention/views.py:94 +#: intervention/views.py:95 msgid "Document '{}' added" msgstr "Dokument '{}' hinzugefügt" -#: intervention/views.py:140 +#: intervention/views.py:147 msgid "" "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 " @@ -436,23 +451,23 @@ msgstr "" "bedeutet, dass Sie nur lesenden Zugriff hierauf haben und weder bearbeiten, " "noch Prüfungen durchführen oder verzeichnen können." -#: intervention/views.py:163 +#: intervention/views.py:170 msgid "{} edited" msgstr "{} bearbeitet" -#: intervention/views.py:225 +#: intervention/views.py:232 msgid "{} has already been shared with you" msgstr "{} wurde bereits für Sie freigegeben" -#: intervention/views.py:230 +#: intervention/views.py:237 msgid "{} has been shared with you" msgstr "{} ist nun für Sie freigegeben" -#: intervention/views.py:237 +#: intervention/views.py:244 msgid "Share link invalid" msgstr "Freigabelink ungültig" -#: intervention/views.py:262 +#: intervention/views.py:269 msgid "Share settings updated" 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." msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!" -#: konova/forms.py:51 +#: konova/forms.py:58 msgid "Not editable" msgstr "Nicht editierbar" -#: konova/forms.py:77 konova/forms.py:154 +#: konova/forms.py:84 konova/forms.py:176 msgid "Confirm" msgstr "Bestätige" -#: konova/forms.py:89 konova/forms.py:163 +#: konova/forms.py:96 konova/forms.py:185 msgid "Remove" msgstr "Löschen" -#: konova/forms.py:91 +#: konova/forms.py:98 msgid "You are about to remove {} {}" msgstr "Sie sind dabei {} {} zu löschen" -#: konova/forms.py:164 +#: konova/forms.py:186 msgid "Are you sure?" 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." 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 msgid "File" msgstr "Datei" -#: konova/forms.py:200 +#: konova/forms.py:265 msgid "Must be smaller than 15 Mb" msgstr "Muss kleiner als 15 Mb sein" -#: konova/forms.py:211 +#: konova/forms.py:276 msgid "Additional comment on this file" msgstr "Zusätzlicher Kommentar" @@ -565,7 +584,11 @@ msgstr "Ökokonto" msgid "Withdraw" 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" msgstr "Dokument '{}' gelöscht" @@ -697,16 +720,28 @@ msgstr "Wann wollen Sie per E-Mail benachrichtigt werden?" msgid "Edit notifications" msgstr "Benachrichtigungen bearbeiten" -#: user/templates/user/index.html:9 +#: user/forms.py:76 user/templates/user/index.html:9 msgid "Username" msgstr "Nutzername" -#: user/templates/user/index.html:13 -msgid "Name" +#: user/forms.py:87 +msgid "Person name" +msgstr "Name" + +#: user/forms.py:98 user/templates/user/index.html:17 +msgid "E-Mail" msgstr "" -#: user/templates/user/index.html:17 -msgid "E-Mail" +#: user/forms.py:112 +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 "" #: user/templates/user/index.html:21 @@ -742,7 +777,7 @@ msgstr "Benachrichtigungseinstellungen ändern" msgid "Notification settings" msgstr "Benachrichtigungen" -#: user/views.py:52 +#: user/views.py:53 msgid "Notifications edited" msgstr "Benachrichtigungen bearbeitet" @@ -2005,9 +2040,6 @@ msgstr "" #~ msgid "Show compensation" #~ msgstr "Zeige Kompensationen" -#~ msgid "New compensation" -#~ msgstr "Neue Kompensation" - #~ msgid "Eco-account management" #~ msgstr "Ökokontoverwaltung" diff --git a/user/forms.py b/user/forms.py index 8793b952..aa475566 100644 --- a/user/forms.py +++ b/user/forms.py @@ -10,7 +10,7 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ from django.contrib.auth.models import User -from konova.forms import BaseForm +from konova.forms import BaseForm, BaseModalForm from user.models import UserNotification, KonovaUserExtension @@ -69,3 +69,51 @@ class UserNotificationForm(BaseForm): id__in=selected_notification_ids, ) 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) + + diff --git a/user/templates/user/includes/contact_modal_button.html b/user/templates/user/includes/contact_modal_button.html new file mode 100644 index 00000000..68ae53a5 --- /dev/null +++ b/user/templates/user/includes/contact_modal_button.html @@ -0,0 +1,6 @@ +{% load fontawesome_5 i18n %} + + \ No newline at end of file diff --git a/user/urls.py b/user/urls.py index fd5ff27d..651e48c2 100644 --- a/user/urls.py +++ b/user/urls.py @@ -13,4 +13,6 @@ app_name = "user" urlpatterns = [ path("", index_view, name="index"), path("notifications/", notifications_view, name="notifications"), + path("contact/", contact_view, name="contact"), + ] \ No newline at end of file diff --git a/user/views.py b/user/views.py index 13fbfee4..5260dd4b 100644 --- a/user/views.py +++ b/user/views.py @@ -1,11 +1,12 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required +from django.contrib.auth.models import User 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 konova.contexts import BaseContext -from user.forms import UserNotificationForm +from user.forms import UserNotificationForm, UserContactForm from user.models import KonovaUserExtension @@ -65,3 +66,28 @@ def notifications_view(request: HttpRequest): } context = BaseContext(request, context).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 + ) \ No newline at end of file