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
This commit is contained in:
parent
b4f9105120
commit
d13ad5ff7d
@ -220,15 +220,28 @@ class OpenInterventionForm(EditInterventionForm):
|
|||||||
self.disable_form_field(field)
|
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):
|
class ShareInterventionForm(BaseModalForm):
|
||||||
url = forms.CharField(
|
url = forms.CharField(
|
||||||
label=_("Share link"),
|
label=_("Share link"),
|
||||||
label_suffix="",
|
label_suffix="",
|
||||||
disabled=True,
|
|
||||||
required=False,
|
required=False,
|
||||||
widget=forms.TextInput(
|
widget=TextToClipboardInput(
|
||||||
attrs={
|
attrs={
|
||||||
"style": "width:100%",
|
"readonly": True
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -251,16 +264,3 @@ class ShareInterventionForm(BaseModalForm):
|
|||||||
"url",
|
"url",
|
||||||
self.share_link
|
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"
|
|
@ -0,0 +1,18 @@
|
|||||||
|
{% load i18n fontawesome_5 %}
|
||||||
|
|
||||||
|
<div class="input-group" title="{{ widget.value|stringformat:'s' }}">
|
||||||
|
<input aria-describedby="copy-btn" type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %}>
|
||||||
|
<div class="input-group-append" onclick="copyClipboard()">
|
||||||
|
<span id="copy-btn" class="btn btn-default" value="{% trans 'Copy to clipboard' %}" title="{% trans 'Copy to clipboard' %}">{% fa5_icon 'clipboard' 'far' %}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function copyClipboard() {
|
||||||
|
var copyText = document.getElementById("id_{{ widget.name }}");
|
||||||
|
copyText.select();
|
||||||
|
copyText.setSelectionRange(0, 99999); /* For mobile devices */
|
||||||
|
document.execCommand("copy");
|
||||||
|
alert("{% trans 'Copied to clipboard' %}");
|
||||||
|
}
|
||||||
|
</script>
|
Binary file not shown.
@ -13,7 +13,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: 2021-07-30 13:23+0200\n"
|
"POT-Creation-Date: 2021-07-30 14:26+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"
|
||||||
@ -58,13 +58,13 @@ 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:27 intervention/tables.py:23
|
#: intervention/forms.py:26 intervention/tables.py:23
|
||||||
#: intervention/templates/intervention/detail/related-objects.html:30
|
#: intervention/templates/intervention/detail/related-objects.html:30
|
||||||
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: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-documents.html:28
|
||||||
#: intervention/templates/intervention/detail/related-objects.html:33
|
#: intervention/templates/intervention/detail/related-objects.html:33
|
||||||
#: intervention/templates/intervention/detail/view.html:60 konova/forms.py:181
|
#: intervention/templates/intervention/detail/view.html:60 konova/forms.py:181
|
||||||
@ -177,89 +177,90 @@ msgstr "Gemarkung"
|
|||||||
msgid "Search for district"
|
msgid "Search for district"
|
||||||
msgstr "Nach Gemarkung suchen"
|
msgstr "Nach Gemarkung suchen"
|
||||||
|
|
||||||
#: intervention/forms.py:30
|
#: intervention/forms.py:29
|
||||||
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:39
|
#: intervention/forms.py:38
|
||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Typ"
|
msgstr "Typ"
|
||||||
|
|
||||||
#: intervention/forms.py:42
|
#: intervention/forms.py:41
|
||||||
msgid "Which intervention type is this"
|
msgid "Which intervention type is this"
|
||||||
msgstr "Welcher Eingriffstyp"
|
msgstr "Welcher Eingriffstyp"
|
||||||
|
|
||||||
#: intervention/forms.py:45
|
#: intervention/forms.py:44
|
||||||
#: 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:48
|
#: intervention/forms.py:47
|
||||||
msgid "Based on which law"
|
msgid "Based on which law"
|
||||||
msgstr "Basiert auf welchem Recht"
|
msgstr "Basiert auf welchem Recht"
|
||||||
|
|
||||||
#: intervention/forms.py:51
|
#: intervention/forms.py:50
|
||||||
#: 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:54
|
#: intervention/forms.py:53
|
||||||
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:57
|
#: intervention/forms.py:56
|
||||||
msgid "Data provider"
|
msgid "Data provider"
|
||||||
msgstr "Datenbereitsteller"
|
msgstr "Datenbereitsteller"
|
||||||
|
|
||||||
#: intervention/forms.py:59
|
#: intervention/forms.py:58
|
||||||
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:64
|
#: intervention/forms.py:63
|
||||||
msgid "Organization"
|
msgid "Organization"
|
||||||
msgstr "Organisation"
|
msgstr "Organisation"
|
||||||
|
|
||||||
#: intervention/forms.py:70
|
#: intervention/forms.py:69
|
||||||
msgid "Data provider details"
|
msgid "Data provider details"
|
||||||
msgstr "Datenbereitsteller Details"
|
msgstr "Datenbereitsteller Details"
|
||||||
|
|
||||||
#: intervention/forms.py:73
|
#: intervention/forms.py:72
|
||||||
msgid "Further details"
|
msgid "Further details"
|
||||||
msgstr "Weitere Details"
|
msgstr "Weitere Details"
|
||||||
|
|
||||||
#: intervention/forms.py:86
|
#: intervention/forms.py:85
|
||||||
msgid "Map"
|
msgid "Map"
|
||||||
msgstr "Karte"
|
msgstr "Karte"
|
||||||
|
|
||||||
#: intervention/forms.py:88
|
#: intervention/forms.py:87
|
||||||
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:96
|
#: intervention/forms.py:95
|
||||||
msgid "Files"
|
msgid "Files"
|
||||||
msgstr "Dateien"
|
msgstr "Dateien"
|
||||||
|
|
||||||
#: intervention/forms.py:103
|
#: intervention/forms.py:102
|
||||||
msgid "New intervention"
|
msgid "New intervention"
|
||||||
msgstr "Neuer Eingriff"
|
msgstr "Neuer Eingriff"
|
||||||
|
|
||||||
#: intervention/forms.py:146
|
#: intervention/forms.py:145
|
||||||
msgid "Edit intervention"
|
msgid "Edit intervention"
|
||||||
msgstr "Eingriff bearbeiten"
|
msgstr "Eingriff bearbeiten"
|
||||||
|
|
||||||
#: intervention/forms.py:226
|
#: intervention/forms.py:239
|
||||||
msgid "Share link"
|
msgid "Share link"
|
||||||
msgstr "Freigabelink"
|
msgstr "Freigabelink"
|
||||||
|
|
||||||
#: intervention/forms.py:239
|
#: intervention/forms.py:251
|
||||||
#: 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:240
|
#: intervention/forms.py:252
|
||||||
msgid ""
|
msgid ""
|
||||||
"Send this link to users who you want to have writing access on the data."
|
"Send this link to users who you want to have writing access on the data."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Senden Sie diesen Link an andere KSP Nutzer, damit diese Schreibrechte auf diese Daten erhalten."
|
||||||
|
|
||||||
#: intervention/tables.py:70
|
#: intervention/tables.py:70
|
||||||
msgid "Interventions"
|
msgid "Interventions"
|
||||||
@ -389,6 +390,14 @@ msgstr "Zuletzt bearbeitet"
|
|||||||
msgid "No geometry added, yet."
|
msgid "No geometry added, yet."
|
||||||
msgstr "Keine Geometrie vorhanden"
|
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
|
#: intervention/views.py:62
|
||||||
msgid "Intervention {} added"
|
msgid "Intervention {} added"
|
||||||
msgstr "Eingriff {} hinzugefügt"
|
msgstr "Eingriff {} hinzugefügt"
|
||||||
|
Loading…
Reference in New Issue
Block a user