Self hosted FLOSS fitness/workout, nutrition and weight tracker
refactor: remove the script tag JS and use the new submitLanguageForm function instead
Franciscoc9b1ed0bba69
diff --git a/wger/core/templates/tags/language_select.html b/wger/core/templates/tags/language_select.htmlindex 90426ad73..2c44e29aa 100644--- a/wger/core/templates/tags/language_select.html+++ b/wger/core/templates/tags/language_select.html@@ -1,7 +1,7 @@{% load i18n static %}<li>- <button class="dropdown-item" type="button" data-language="{{ code }}">+ <button class="dropdown-item" type="button" onclick="submitLanguageForm('{{ code }}')"><img src="{% static path %}"width="20"alt="{% translate name %}"diff --git a/wger/core/templates/template.html b/wger/core/templates/template.htmlindex 9df9d3f46..c220197c5 100644--- a/wger/core/templates/template.html+++ b/wger/core/templates/template.html@@ -66,6 +66,7 @@</script><script src="{% static 'node/masonry-layout/dist/masonry.pkgd.min.js' %}"></script><script src="{% static 'js/nutrition.js' %}"></script>+ <script src="{% static 'js/language.js' %}"></script>{% endcompress %}{# this needs to be outside of the compress block! #}@@ -218,23 +219,6 @@{% language_select language %}{% endfor %}</form>- <script>- document.querySelectorAll('[data-language]').forEach(item => {- item.addEventListener('click', function(e) {- e.preventDefault();- const langCode = this.dataset.language;-- if (langCode === '') {- // Delete cookie and reload- document.cookie = 'django_language=; path=/; max-age=0';- window.location.reload();- } else {- document.getElementById('language-input').value = langCode;- document.getElementById('language-form').submit();- }- });- });- </script><li><hr class="dropdown-divider"></hr>