From c72ff615ba94e4f2a5932e34da41515d8a965c8d Mon Sep 17 00:00:00 2001 From: mipel Date: Mon, 2 Aug 2021 14:10:57 +0200 Subject: [PATCH] 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 --- .../templates/intervention/detail/view.html | 5 +- locale/de/LC_MESSAGES/django.mo | Bin 10604 -> 11030 bytes locale/de/LC_MESSAGES/django.po | 202 ++++++++++-------- user/forms.py | 50 ++++- .../user/includes/contact_modal_button.html | 6 + user/urls.py | 2 + user/views.py | 30 ++- 7 files changed, 205 insertions(+), 90 deletions(-) create mode 100644 user/templates/user/includes/contact_modal_button.html diff --git a/intervention/templates/intervention/detail/view.html b/intervention/templates/intervention/detail/view.html index 2ade6d7..1a20a62 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 90c3fce3ff4dcfbd4547900db94595f6d6d1391c..cd1378796f0831be3c07aebab7a512706ac9f65e 100644 GIT binary patch delta 4014 zcmZXV2XItX6ozj|AtaQ91QStU2@psOL^L3ZK?qVKEg&GMkg|{n*_E&mMB!ON2?7yT zibz+w6kUN4JAz$wu%O7qp*W)mGJxnf*6-iFi>P<@f8V+H-FNP}=iK-9Ou^FOPHp3; zC5E;QU5k9t#(WDujN?KZ+t3(4EQF2WCCk`G#>CLS2G)gXuocXN$#5V{fW?rX@o{MZ zt6(I27V^AfHe=w^?1c5g)#KN-rxWW!&v&CLPdPc-v1pY(of)`K+>QB%Ybs21Dn7+dw(RX zM}G{IzcQ$GDxl`g)_vADD>3A7BjjhcbJ2v?p(6hrYG)^46#NnLGZ(oiL(yE6fmEo4 zT<{v00X4rD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f-qzR99O4kizojG2X+ zsTY+<8EQ{Apq8`>wK4~hvCXHbExd?I^cFIPxsO_z7L2AuvQZQ2i##$T(5oNJwhtDd z2J)izcr&WwD%4>*j5;(&(Tyii3Dl!L--oF0J|;OhpbK?IQc%yk+V+vC{tJ`Yefwidi8vEk=*p7QY>abn0?RQb{HQ0M62S5q8L~=2ys2S&=4rLzd_Y+YoJ1@l> zoY`U;deE=}wZz9zdsT;;`5&ks{DayWr#sjliCWrdhPSybi9Y1F^OMiU@mHfO0WxlfEwr;YUaP7mi{4X1)Y34 zTA^mBucHmJ(q5BAMKc+Q+MCg+%x0kyDY33a&9nm91+y2G;AzzRw`}`g_$~KIZG$U& z8~bs8A2o2-c0mVW6UH}%wqY`=qxq;Al%e)$Gb*u4)G0oMnsFWW#Ydd5s>@N-K=t;ir$g88V9CR&Rz zocmJL=d}`hVL9r1uS0FY4b)aYLT@$|S6VQETy%3k4*6#mbLow{kzCAG)Bs@|2n`T{ z5g3hHfdphRj0d$vx#&O@^`lZj3@5^f721C#Fqs%gj3;!+RNTZgRcu*}qX{LV(t*(6 z`dn2CiMfPUXgjfx&}@~c%H|+}t5#Q~pZ33q3WqdMp5>}jtum7+Bc>1oh^~Z|dk~?r zHHcY^iwK>KcWs-9B-YvcZukztM`YF$V~Bmk67By8Lgl?6|6S)(dyyDxTlV5eLVMTV zwuNY7D{tdAVm7gx*h7TMgir-_uBH+iKTx8%ZX$XTI;|>0iRXzNqJ(&b;42Cg?ei!i zmUx+%PNWcT5h^i-FS ze%*-zLNi%TgvtBJjECnAd&Mr;htznYsFL`R~Mc#~K|)DYtcm1V>{;yHpZ z$K(<(5rc`9gg!O>>CGVWh!~;~(S^t-iiuE}NM#q%V+t1+5h_k9rS@hL&I&!S_Q9ou zkLXXRtRnQEP8_k8P}xAF60iG, 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,18 +720,30 @@ 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" -msgstr "" +#: user/forms.py:87 +msgid "Person name" +msgstr "Name" -#: user/templates/user/index.html:17 +#: user/forms.py:98 user/templates/user/index.html:17 msgid "E-Mail" msgstr "" +#: 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 msgid "Groups" msgstr "Gruppen" @@ -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 8793b95..aa47556 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 0000000..68ae53a --- /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 fd5ff27..651e48c 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 13fbfee..5260dd4 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