Feature #29473 » feature-29473.patch
| public/javascripts/application.js | ||
|---|---|---|
| 785 | 785 |
} |
| 786 | 786 |
}( jQuery )); |
| 787 | 787 | |
| 788 |
var isSubmitAction; |
|
| 788 | 789 |
var warnLeavingUnsavedMessage; |
| 789 | 790 |
function warnLeavingUnsaved(message) {
|
| 790 | 791 |
warnLeavingUnsavedMessage = message; |
| ... | ... | |
| 801 | 802 |
warn = true; |
| 802 | 803 |
} |
| 803 | 804 |
}); |
| 804 |
if (warn) {return warnLeavingUnsavedMessage;}
|
|
| 805 |
if (warn && !isSubmitAction) {isSubmitAction = false; return warnLeavingUnsavedMessage;}
|
|
| 805 | 806 |
}; |
| 806 | 807 |
} |
| 807 | 808 | |
| ... | ... | |
| 851 | 852 |
} |
| 852 | 853 |
} |
| 853 | 854 | |
| 854 | ||
| 855 |
$(document).on('keydown', 'form input, form textarea', function(e) {
|
|
| 856 |
// Click the form submit button with Ctrl + Enter or Command + Return as the trigger. |
|
| 857 |
var submitButton = $(e.target).closest('form').find('input[type=submit]');
|
|
| 858 |
if(e.keyCode == 13 && ((e.ctrlKey && !e.metaKey) || (!e.ctrlKey && e.metaKey)) && submitButton.length) {
|
|
| 859 |
isSubmitAction = true; |
|
| 860 |
submitButton.first().click(); |
|
| 861 |
} |
|
| 862 |
}); |
|
| 855 | 863 | |
| 856 | 864 |
function hideOnLoad() {
|
| 857 | 865 |
$('.hol').hide();
|