diff --git a/HISTORY.rst b/HISTORY.rst index c256289392..93a0e9bcb2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -141,6 +141,11 @@ * Remove the full name from the user list. * Add the first name and last name to the user list. * Add file metadata app. +* Add support for submitting forms by pressing the + Enter key or by double clicking. +* Rename form template 'form_class' to 'form_css_classes'. +* Add support for adding form button aside from the + default submit and cancel. 3.1.11 (2019-04-XX) =================== diff --git a/docs/releases/3.2.rst b/docs/releases/3.2.rst index 20e9f26051..53ff0eae91 100644 --- a/docs/releases/3.2.rst +++ b/docs/releases/3.2.rst @@ -173,6 +173,11 @@ Other changes * Remove the full name from the user list. * Add the first name and last name to the user list. * Add file metadata app. +* Add support for submitting forms by pressing the + Enter key or by double clicking. +* Rename form template 'form_class' to 'form_css_classes'. +* Add support for adding form button aside from the + default submit and cancel. Removals -------- diff --git a/mayan/apps/appearance/static/appearance/js/mayan_app.js b/mayan/apps/appearance/static/appearance/js/mayan_app.js index 9a04769c41..4011ce59ca 100644 --- a/mayan/apps/appearance/static/appearance/js/mayan_app.js +++ b/mayan/apps/appearance/static/appearance/js/mayan_app.js @@ -156,6 +156,7 @@ class MayanApp { this.setupAJAXSpinner(); this.setupAutoSubmit(); + this.setupFormHotkeys(); this.setupFullHeightResizing(); this.setupItemsSelector(); this.setupNavbarCollapse(); @@ -195,6 +196,21 @@ class MayanApp { }); } + setupFormHotkeys () { + $('body').on('keypress', '.form-hotkey-enter', function (e) { + if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { + $(this).find('.btn-hotkey-default').click(); + return false; + } else { + return true; + } + }); + $('body').on('dblclick', '.form-hotkey-double-click', function (e) { + $(this).find('.btn-hotkey-default').click(); + return false; + }); + } + setupFullHeightResizing () { var self = this; diff --git a/mayan/apps/appearance/templates/appearance/generic_form_subtemplate.html b/mayan/apps/appearance/templates/appearance/generic_form_subtemplate.html index c9e3b313f2..21bdc64815 100644 --- a/mayan/apps/appearance/templates/appearance/generic_form_subtemplate.html +++ b/mayan/apps/appearance/templates/appearance/generic_form_subtemplate.html @@ -10,9 +10,9 @@
{% if form.is_multipart %} -
+ {% else %} - + {% endif %} {{ wizard.management_form }} @@ -58,11 +58,7 @@ {% include 'appearance/generic_form_instance.html' %} {% empty %} - {% if form_empty_label %}{{ form_empty_label }}{% else %} - {% include 'appearance/no_results.html' %} - - {% endif %} {% endfor %} @@ -79,7 +75,7 @@ {% if not form.management_form or wizard.management_form or form.forms %} {# Is a normal form, a wizard form, or a formset with at least one form #}
- + {% endfor %}
{% endif %} {% endif %} diff --git a/mayan/apps/appearance/templates/appearance/generic_multiform_subtemplate.html b/mayan/apps/appearance/templates/appearance/generic_multiform_subtemplate.html index eb695f0775..d5ebac6d14 100644 --- a/mayan/apps/appearance/templates/appearance/generic_multiform_subtemplate.html +++ b/mayan/apps/appearance/templates/appearance/generic_multiform_subtemplate.html @@ -2,9 +2,9 @@ {% load static %}
{% if is_multipart %} - + {% else %} - + {% endif %} {% for form_name, form in forms.items %} @@ -56,7 +56,7 @@
{% if not form_disable_submit %} - + {% endif %} {% if previous %}   @@ -64,6 +64,7 @@ {% endif %}
+ {% endif %}