Commit a8624cbe5927ceed786b5aa68fe9e917b1d8cbee

Authored by skv-headless
1 parent dd3a5506

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 53 # fetch notes when tab becomes visible
54 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 62 cleanBinding: ->
57 63 $(document).off "ajax:success", ".js-main-target-form"
58 64 $(document).off "ajax:success", ".js-discussion-note-form"
... ... @@ -67,6 +73,7 @@ class Notes
67 73 $(document).off "click", ".js-discussion-reply-button"
68 74 $(document).off "click", ".js-add-diff-note-button"
69 75 $(document).off "visibilitychange"
  76 + $(document).off "keypress", @notes_forms
70 77  
71 78  
72 79 initRefresh: ->
... ...