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)
|
||||
|
||||
|
||||
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"
|
@ -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 ""
|
||||
"Project-Id-Version: PACKAGE VERSION\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"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\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"
|
||||
|
||||
#: 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"
|
||||
|
Loading…
Reference in New Issue
Block a user