From d13ad5ff7d9f36b0769a8408941a93eaf37a2f28 Mon Sep 17 00:00:00 2001 From: mipel Date: Fri, 30 Jul 2021 14:34:36 +0200 Subject: [PATCH] Share url view * adds modal for rendering the share url * adds new custom_widget text-to-clipboard-input.html * provides a copy button for writing the text input's value into the client's clipboard * adds translation --- intervention/forms.py | 32 +++++----- .../custom_widgets}/dummy-filter-input.html | 0 .../text-to-clipboard-input.html | 18 ++++++ locale/de/LC_MESSAGES/django.mo | Bin 9498 -> 9855 bytes locale/de/LC_MESSAGES/django.po | 55 ++++++++++-------- 5 files changed, 66 insertions(+), 39 deletions(-) rename {intervention/templates/intervention => konova/templates/konova/custom_widgets}/dummy-filter-input.html (100%) create mode 100644 konova/templates/konova/custom_widgets/text-to-clipboard-input.html diff --git a/intervention/forms.py b/intervention/forms.py index 8f03e927..bf682885 100644 --- a/intervention/forms.py +++ b/intervention/forms.py @@ -220,15 +220,28 @@ class OpenInterventionForm(EditInterventionForm): self.disable_form_field(field) +class DummyFilterInput(forms.HiddenInput): + """ A dummy input widget + + Does not render anything. Can be used to keep filter logic using django_filter without having a pre defined + filter widget being rendered to the template. + + """ + template_name = "konova/custom_widgets/dummy-filter-input.html" + + +class TextToClipboardInput(forms.TextInput): + template_name = "konova/custom_widgets/text-to-clipboard-input.html" + + class ShareInterventionForm(BaseModalForm): url = forms.CharField( label=_("Share link"), label_suffix="", - disabled=True, required=False, - widget=forms.TextInput( + widget=TextToClipboardInput( attrs={ - "style": "width:100%", + "readonly": True } ) ) @@ -251,16 +264,3 @@ class ShareInterventionForm(BaseModalForm): "url", self.share_link ) - - def save(self): - i = 0 - - -class DummyFilterInput(forms.HiddenInput): - """ A dummy input widget - - Does not render anything. Can be used to keep filter logic using django_filter without having a pre defined - filter widget being rendered to the template. - - """ - template_name = "intervention/dummy-filter-input.html" \ No newline at end of file diff --git a/intervention/templates/intervention/dummy-filter-input.html b/konova/templates/konova/custom_widgets/dummy-filter-input.html similarity index 100% rename from intervention/templates/intervention/dummy-filter-input.html rename to konova/templates/konova/custom_widgets/dummy-filter-input.html diff --git a/konova/templates/konova/custom_widgets/text-to-clipboard-input.html b/konova/templates/konova/custom_widgets/text-to-clipboard-input.html new file mode 100644 index 00000000..9da9e540 --- /dev/null +++ b/konova/templates/konova/custom_widgets/text-to-clipboard-input.html @@ -0,0 +1,18 @@ +{% load i18n fontawesome_5 %} + +
+ +
+ {% fa5_icon 'clipboard' 'far' %} +
+
+ + \ No newline at end of file diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 677fcf6f7feb7dfc88540e1ccf2c06ff0c619cba..1c3fb20def9da68a4ca9e0a1632299e2d45407a4 100644 GIT binary patch delta 3607 zcmZ|Q32anF9LMni%3aX5fFMvFP>^!89K{NXQZ6}40ShX3x9y|5wCtAcmQqkwkaB}y zxj`@*B?zQSiPAub0TYcx#SkJ!Ab<%+6cPd=nh1V>yVInSIO%^sGxOfg@qhESJI6lC z3}1?m*i8nDG-)vz_Bix9MaT|8Uz1Rv*;gfhCpTL{g z3IDOtCj)VI1vT)B-}N1uaGmxB^?_W_$e;RI)z9CU^`r z(O0PZ&fDv^QR6*8jsFN^ncu{bFYP1|$-e1{x*-*nkqp#|C!;2qf$h=7hPV_p;Ywso zvkQ~)0BXW>sBte?ub?(`4Z}*+9V&Wu4^b;lV0P^^*_w{p;Yiz_fO?iQQ4@G<+lv~n z2({31)Wpl|^_8e`)*@4xEpg;uH+)RTQ+NQigHx!1&Z07K*x~#q3u}eiSrY2LKB()1 zZF@8-BU3Q)sBFKBT38U-gISIInO$K%b@-}q5B`7}z|XccVJUKeO$BO!n^CFTjoR@c zR0h95eeXDG;8WJ0a0u<+a5N^9J}oSWIy>RTRCE}YBAYeqP!sP(4P1rV;SuXe)XvYK zgBMW)J+#KKO)an)>U-@`<0PXdPQmV&j%++^W>M)##}e#`yHPiOZTrt)8tvQmdRHD? zZ`xT{9~Yw*umqKn<)|N|4XC%|Fb=C{%=fsDb{q$y2i9QZ{l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 +58,13 @@ msgid "Add a payment for intervention '{}'" msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen" #: compensation/tables.py:24 compensation/tables.py:164 -#: intervention/forms.py:27 intervention/tables.py:23 +#: intervention/forms.py:26 intervention/tables.py:23 #: intervention/templates/intervention/detail/related-objects.html:30 msgid "Identifier" msgstr "Kennung" #: compensation/tables.py:29 compensation/tables.py:169 -#: intervention/forms.py:34 intervention/tables.py:28 +#: intervention/forms.py:33 intervention/tables.py:28 #: intervention/templates/intervention/detail/related-documents.html:28 #: intervention/templates/intervention/detail/related-objects.html:33 #: intervention/templates/intervention/detail/view.html:60 konova/forms.py:181 @@ -177,89 +177,90 @@ msgstr "Gemarkung" msgid "Search for district" msgstr "Nach Gemarkung suchen" -#: intervention/forms.py:30 +#: intervention/forms.py:29 msgid "Generated automatically if none was given" msgstr "Wird automatisch erzeugt, falls nicht angegeben" -#: intervention/forms.py:39 +#: intervention/forms.py:38 msgid "Type" msgstr "Typ" -#: intervention/forms.py:42 +#: intervention/forms.py:41 msgid "Which intervention type is this" msgstr "Welcher Eingriffstyp" -#: intervention/forms.py:45 +#: intervention/forms.py:44 #: intervention/templates/intervention/detail/view.html:68 msgid "Law" msgstr "Gesetz" -#: intervention/forms.py:48 +#: intervention/forms.py:47 msgid "Based on which law" msgstr "Basiert auf welchem Recht" -#: intervention/forms.py:51 +#: intervention/forms.py:50 #: intervention/templates/intervention/detail/view.html:88 msgid "Intervention handler" msgstr "Eingriffsverursacher" -#: intervention/forms.py:54 +#: intervention/forms.py:53 msgid "Who performs the intervention" msgstr "Wer führt den Eingriff durch" -#: intervention/forms.py:57 +#: intervention/forms.py:56 msgid "Data provider" msgstr "Datenbereitsteller" -#: intervention/forms.py:59 +#: intervention/forms.py:58 msgid "Who provides the data for the intervention" msgstr "Wer stellt die Daten für den Eingriff zur Verfügung" -#: intervention/forms.py:64 +#: intervention/forms.py:63 msgid "Organization" msgstr "Organisation" -#: intervention/forms.py:70 +#: intervention/forms.py:69 msgid "Data provider details" msgstr "Datenbereitsteller Details" -#: intervention/forms.py:73 +#: intervention/forms.py:72 msgid "Further details" msgstr "Weitere Details" -#: intervention/forms.py:86 +#: intervention/forms.py:85 msgid "Map" msgstr "Karte" -#: intervention/forms.py:88 +#: intervention/forms.py:87 msgid "Where does the intervention take place" msgstr "Wo findet der Eingriff statt" -#: intervention/forms.py:96 +#: intervention/forms.py:95 msgid "Files" msgstr "Dateien" -#: intervention/forms.py:103 +#: intervention/forms.py:102 msgid "New intervention" msgstr "Neuer Eingriff" -#: intervention/forms.py:146 +#: intervention/forms.py:145 msgid "Edit intervention" msgstr "Eingriff bearbeiten" -#: intervention/forms.py:226 +#: intervention/forms.py:239 msgid "Share link" msgstr "Freigabelink" -#: intervention/forms.py:239 +#: intervention/forms.py:251 #: intervention/templates/intervention/detail/view.html:27 msgid "Share" msgstr "Freigabe" -#: intervention/forms.py:240 +#: intervention/forms.py:252 msgid "" "Send this link to users who you want to have writing access on the data." msgstr "" +"Senden Sie diesen Link an andere KSP Nutzer, damit diese Schreibrechte auf diese Daten erhalten." #: intervention/tables.py:70 msgid "Interventions" @@ -389,6 +390,14 @@ msgstr "Zuletzt bearbeitet" msgid "No geometry added, yet." msgstr "Keine Geometrie vorhanden" +#: intervention/templates/intervention/text-to-clipboard-input.html:6 +msgid "Copy to clipboard" +msgstr "In Zwischenablage kopieren" + +#: intervention/templates/intervention/text-to-clipboard-input.html:16 +msgid "Copied to clipboard" +msgstr "In Zwischenablage kopiert" + #: intervention/views.py:62 msgid "Intervention {} added" msgstr "Eingriff {} hinzugefügt"