diff options
author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2012-11-22 00:42:55 +0100 |
---|---|---|
committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2012-12-03 22:51:56 +0100 |
commit | 918dc873768359cbb7de5e83bc900fb0dacce938 (patch) | |
tree | 9b9159fbd4e7b3d7faa69af415863a09028b402d /app/assets/javascripts/notes.js | |
parent | fac4e3f2e5ea62ed4b92722f5eb1a650ccccf4b1 (diff) | |
download | gitlab-ce-918dc873768359cbb7de5e83bc900fb0dacce938.tar.gz |
Move code for appending a discussion note to notes JS
Diffstat (limited to 'app/assets/javascripts/notes.js')
-rw-r--r-- | app/assets/javascripts/notes.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 7f4bd330839..fec91c1fdb5 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -377,6 +377,20 @@ var NoteList = { this.updateVotes(); }, + appendNewDiscussionNote: function(discussionId, diffRowHtml, noteHtml) { + // is this the first note of discussion? + var row = $("form[rel='"+discussionId+"']").closest("tr"); + if (row.is(".js-temp-notes-holder")) { + // insert the note and the reply button after it + row.after(diffRowHtml); + // will be added again below + row.next().find(".note").remove(); + } + + // append new note to all matching discussions + $(".notes[rel='"+discussionId+"']").append(noteHtml); + }, + /** * Recalculates the votes and updates them (if they are displayed at all). * |