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 @@