diff options
author | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-01-13 16:57:46 -0500 |
---|---|---|
committer | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-01-13 16:57:46 -0500 |
commit | 1eb3e8acb61e837768d3aea93ae28b819efb9702 (patch) | |
tree | 4511e8b4f9fa0ed5182acef96f2ba06d5bdf6525 | |
parent | 0e344aa2299d2f6911282de5d4808c70d658d372 (diff) | |
download | gitlab-ce-1eb3e8acb61e837768d3aea93ae28b819efb9702.tar.gz |
fixes bug with commenting on merge requestsclosing-mr-bug-fix
-rw-r--r-- | app/assets/javascripts/merge_request.js.coffee | 13 | ||||
-rw-r--r-- | app/assets/javascripts/notes.js.coffee | 4 |
2 files changed, 11 insertions, 6 deletions
diff --git a/app/assets/javascripts/merge_request.js.coffee b/app/assets/javascripts/merge_request.js.coffee index ed0bf2b3f48..1f46e331427 100644 --- a/app/assets/javascripts/merge_request.js.coffee +++ b/app/assets/javascripts/merge_request.js.coffee @@ -48,14 +48,15 @@ class @MergeRequest _this = @ $('a.btn-close, a.btn-reopen').on 'click', (e) -> $this = $(this) - if $this.data('submitted') - return - e.preventDefault() - e.stopImmediatePropagation() shouldSubmit = $this.hasClass('btn-comment') - console.log("shouldSubmit") + if shouldSubmit && $this.data('submitted') + return if shouldSubmit - _this.submitNoteForm($this.closest('form'),$this) + if $this.hasClass('btn-comment-and-close') || $this.hasClass('btn-comment-and-reopen') + e.preventDefault() + e.stopImmediatePropagation() + _this.submitNoteForm($this.closest('form'),$this) + submitNoteForm: (form, $button) => noteText = form.find("textarea.js-note-text").val() diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 8ba00ecbbab..fcf50dd1b51 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -521,9 +521,13 @@ class @Notes if textarea.val().trim().length > 0 form.find('.js-note-target-reopen').text('Comment & reopen') form.find('.js-note-target-close').text('Comment & close') + form.find('.js-note-target-reopen').addClass('btn-comment-and-reopen') + form.find('.js-note-target-close').addClass('btn-comment-and-close') else form.find('.js-note-target-reopen').text('Reopen') form.find('.js-note-target-close').text('Close') + form.find('.js-note-target-reopen').removeClass('btn-comment-and-reopen') + form.find('.js-note-target-close').removeClass('btn-comment-and-close') initTaskList: -> @enableTaskList() |