diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-07-06 16:00:30 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-07-06 16:05:50 +0200 |
commit | ab8e92b36463e2592469cdd137b09ce43c75c33f (patch) | |
tree | a7b1d4747d6be8f468fa88a37dc2c77c8c6a8dda /ishtar_common | |
parent | 17a408ce343376f883c4ba0737d3a36c349db2ce (diff) | |
download | Ishtar-ab8e92b36463e2592469cdd137b09ce43c75c33f.tar.bz2 Ishtar-ab8e92b36463e2592469cdd137b09ce43c75c33f.zip |
💄 wizards: validate forms with CTRL+ENTER
Diffstat (limited to 'ishtar_common')
4 files changed, 17 insertions, 3 deletions
diff --git a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html index e4fd739f6..1f0d0e4d9 100644 --- a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html @@ -5,7 +5,7 @@ {% include "ishtar/blocks/wizard_breadcrumb.html" %} -<form action="." method="post">{% csrf_token %} +<form class='wizard-form' action="." method="post">{% csrf_token %} <div class='form container'> {% block "warning_informations" %}{% endblock %} {% block "warning_message" %} @@ -62,4 +62,13 @@ </div> </form> +<script type="text/javascript">{% localize off %} +$(document).ready(function(){ + $(document).keydown(function(e){ + if (e.ctrlKey && e.keyCode == 13) { + $("#submit_form").click(); + } + }); +}); +{% endlocalize %}</script> {% endblock %} diff --git a/ishtar_common/templates/ishtar/wizard/default_wizard.html b/ishtar_common/templates/ishtar/wizard/default_wizard.html index 405c52965..fcc020816 100644 --- a/ishtar_common/templates/ishtar/wizard/default_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/default_wizard.html @@ -66,6 +66,11 @@ $(document).ready(function(){ {% block "js_extra_ready" %} {% endblock %} if ($("[autofocus]").length > 0) autofocus_field = "#" + $($("[autofocus]")[0]).attr('id'); + $(".wizard-form").keydown(function(e){ + if (e.ctrlKey && e.keyCode == 13) { + $("#submit_form").click(); + } + }); }); {% endlocalize %}</script> {% endblock %} diff --git a/ishtar_common/templates/ishtar/wizard/relations_wizard.html b/ishtar_common/templates/ishtar/wizard/relations_wizard.html index c22b58f3d..df61502e2 100644 --- a/ishtar_common/templates/ishtar/wizard/relations_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/relations_wizard.html @@ -4,7 +4,7 @@ {{wizard.form.media}} {% endblock %} {% block wizard_form %} -<form action="." method="post">{% csrf_token %} +<form action="." class="wizard-form" method="post">{% csrf_token %} <div class='form container'> {{ wizard.form.media }} {{ wizard.management_form }} diff --git a/ishtar_common/templates/ishtar/wizard/towns_wizard.html b/ishtar_common/templates/ishtar/wizard/towns_wizard.html index 889108f32..022fcdb4f 100644 --- a/ishtar_common/templates/ishtar/wizard/towns_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/towns_wizard.html @@ -5,7 +5,7 @@ {{wizard.form.media}} {% endblock %} {% block wizard_form %} -<form action="." method="post">{% csrf_token %} +<form class='wizard-form' action="." method="post">{% csrf_token %} <div class='form'> {% if TOWNS %} {% if wizard.form.forms %} |