diff options
author | Phil Hughes <me@iamphill.com> | 2016-03-30 13:39:41 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-04-04 10:48:49 +0100 |
commit | 0581df2971d63bcb7966637b6a3da2b4d7feb62d (patch) | |
tree | fcbf8abc5f33d0f31eda1f9e2f1e5da4b59c36ea /app/assets/javascripts/notes.js.coffee | |
parent | f0d2f370ccef7fd1fca4477111e6ded8133c4b36 (diff) | |
download | gitlab-ce-0581df2971d63bcb7966637b6a3da2b4d7feb62d.tar.gz |
Discussion form
Diffstat (limited to 'app/assets/javascripts/notes.js.coffee')
-rw-r--r-- | app/assets/javascripts/notes.js.coffee | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index ae16769ad4b..22cad1d6124 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -254,6 +254,9 @@ class @Notes # find the form form = $(".js-new-note-form") + # Set a global clone of the form for later cloning + @formClone = form.clone() + # show the form @setupNoteForm(form) @@ -452,15 +455,15 @@ class @Notes Shows the note form below the notes. ### replyToDiscussionNote: (e) => - form = $(".js-new-note-form") + form = @formClone.clone() replyLink = $(e.target).closest(".js-discussion-reply-button") replyLink.hide() # insert the form after the button - form.clone().insertAfter replyLink + replyLink.after form # show the form - @setupDiscussionNoteForm(replyLink, replyLink.next("form")) + @setupDiscussionNoteForm(replyLink, form) ### Shows the diff or discussion form and does some setup on it. @@ -485,7 +488,9 @@ class @Notes .text(form.find('.js-close-discussion-note-form').data('cancel-text')) @setupNoteForm form form.find(".js-note-text").focus() - form.addClass "js-discussion-note-form" + form + .removeClass('js-main-target-form') + .addClass("discussion-form js-discussion-note-form") ### Called when clicking on the "add a comment" button on the side of a diff line. |