Feature #29473 » feature-29473-v2.patch
public/javascripts/application.js | ||
---|---|---|
851 | 851 |
} |
852 | 852 |
} |
853 | 853 | |
854 | ||
854 |
$(document).on('keydown', 'form input, form textarea', function(e) { |
|
855 |
// Submit the form with Ctrl + Enter or Command + Return |
|
856 |
var targetForm = $(e.target).closest('form'); |
|
857 |
if(e.keyCode == 13 && ((e.ctrlKey && !e.metaKey) || (!e.ctrlKey && e.metaKey) && targetForm.length)) { |
|
858 |
$(e.target).closest('form').find('textarea').blur().removeData('changed'); |
|
859 |
// Click input[type=submit] if it exists. |
|
860 |
// As a workaround for the problem that ajax request fails in `targetForm.submit();` |
|
861 |
// Example: new_issue_category modal on the issues/edit |
|
862 |
if (targetForm.find('input[type=submit]').length) { |
|
863 |
targetForm.find('input[type=submit]').first().click(); |
|
864 |
} else { |
|
865 |
targetForm.submit(); |
|
866 |
} |
|
867 |
} |
|
868 |
}); |
|
855 | 869 | |
856 | 870 |
function hideOnLoad() { |
857 | 871 |
$('.hol').hide(); |