Skip to content
Snippets Groups Projects
Commit 1e1173fb authored by Nadja Geisler's avatar Nadja Geisler :sunny:
Browse files

Merge branch 'fix-lang-form-reset' into 'master'

Prevent clearing of form when changing language in between

Closes #80

See merge request kif/akplanning!42
parents 0a62d76a 8ef77771
Branches
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-19 06:38+0000\n"
"POT-Creation-Date: 2020-05-19 21:50+0000\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"
......@@ -46,10 +46,15 @@ msgstr "Anzahl"
msgid "Event Status"
msgstr "Event-Status"
#: templates/base.html:78
#: templates/base.html:28
msgid ""
"Are you sure you want to change the language now? This will clear the form!"
msgstr "Wirklich jetzt die Sprache ändern? Das wird das Formular zurücksetzen!"
#: templates/base.html:97
msgid "Impress"
msgstr "Impressum"
#: templates/base.html:81
#: templates/base.html:100
msgid "This software is open source"
msgstr "Diese Software ist Open Source"
......@@ -19,6 +19,26 @@
<link rel="stylesheet" href="{% static 'common/css/custom.css' %}">
<script type='text/javascript'>
var changed_form = false;
$(document).ready(function() {
// Ask before changing language if user changed main form on page
$("#language-switcher").submit(function(e){
if(changed_form) {
if(!confirm("{% trans 'Are you sure you want to change the language now? This will clear the form!' %}"))
e.preventDefault(e);
}
});
// Remember any main form edits/changes
$("form.post-form :input").change(function(){
if($(this).val() != '')
changed_form = true;
});
});
</script>
{% block imports %}{% endblock %}
</head>
<body>
......@@ -29,6 +49,7 @@
method="post"
class="form-inline"
name="language-form"
id="language-switcher"
style="flex-direction: column;">
{% csrf_token %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment