From: Damien Lespiau Date: Mon, 24 Aug 2015 16:49:52 +0000 (+0100) Subject: filters: Submit the form when is pressed on a closed submitter field X-Git-Tag: v1.1.0~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edffce4856d4f5d86ca6c819de14cd43f9c4a333;p=thirdparty%2Fpatchwork.git filters: Submit the form when is pressed on a closed submitter field when an element of the form is focused should submit the form. Before this patch, when was pressed on the submitter button, nothing would happen. So, we tweak our handling on the submitter input a bit more: can be used to select the submitter from the autocompletion list, but, when pressed a second time (ie. when the autocompletion option has be selected and the dropdown isn't shown), we submit the form. Signed-off-by: Damien Lespiau --- diff --git a/patchwork/templates/patchwork/filters.html b/patchwork/templates/patchwork/filters.html index 1af943b9..fe0c9b85 100644 --- a/patchwork/templates/patchwork/filters.html +++ b/patchwork/templates/patchwork/filters.html @@ -27,9 +27,11 @@ Selectize.define('enter_key_submit', function (options) { var original = self.onKeyDown; return function (e) { + var wasOpened = this.isOpen; original.apply(this, arguments); - if (e.keyCode === 13 && this.$control_input.val() != '' ) + if (e.keyCode === 13 && + (this.$control_input.val() != '' || !wasOpened)) self.trigger('submit'); }; })();