Commit a8624cbe5927ceed786b5aa68fe9e917b1d8cbee
1 parent
dd3a5506
Exists in
spb-stable
and in
2 other branches
submit notes forms by pressing ctrl+enter
Showing
1 changed file
with
7 additions
and
0 deletions
Show diff stats
app/assets/javascripts/notes.js.coffee
| @@ -53,6 +53,12 @@ class Notes | @@ -53,6 +53,12 @@ class Notes | ||
| 53 | # fetch notes when tab becomes visible | 53 | # fetch notes when tab becomes visible |
| 54 | $(document).on "visibilitychange", @visibilityChange | 54 | $(document).on "visibilitychange", @visibilityChange |
| 55 | 55 | ||
| 56 | + @notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea' | ||
| 57 | + $(document).on('keypress', @notes_forms, (e)-> | ||
| 58 | + if event.keyCode == 10 || (event.ctrlKey && event.keyCode == 13) | ||
| 59 | + $(@).parents('form').submit() | ||
| 60 | + ) | ||
| 61 | + | ||
| 56 | cleanBinding: -> | 62 | cleanBinding: -> |
| 57 | $(document).off "ajax:success", ".js-main-target-form" | 63 | $(document).off "ajax:success", ".js-main-target-form" |
| 58 | $(document).off "ajax:success", ".js-discussion-note-form" | 64 | $(document).off "ajax:success", ".js-discussion-note-form" |
| @@ -67,6 +73,7 @@ class Notes | @@ -67,6 +73,7 @@ class Notes | ||
| 67 | $(document).off "click", ".js-discussion-reply-button" | 73 | $(document).off "click", ".js-discussion-reply-button" |
| 68 | $(document).off "click", ".js-add-diff-note-button" | 74 | $(document).off "click", ".js-add-diff-note-button" |
| 69 | $(document).off "visibilitychange" | 75 | $(document).off "visibilitychange" |
| 76 | + $(document).off "keypress", @notes_forms | ||
| 70 | 77 | ||
| 71 | 78 | ||
| 72 | initRefresh: -> | 79 | initRefresh: -> |