gitlabhq/app/views/notes/_create_diff_note.js.haml

19 lines
841 B
Plaintext
Raw Normal View History

- if note.valid?
:plain
// hide and reset the form
$(".per_line_form").hide();
$('.line-note-form-holder textarea').val("");
// find the reply button for this line
// (might not be there if this is the first note)
var trRpl = $(".js-note-add-to-diff-line[data-noteable-type='#{note.noteable_type}'][data-noteable-id='#{note.noteable_id}'][data-line-code='#{note.line_code}']").closest("tr");
if (trRpl.size() == 0) {
// find the commented line ...
var trEl = $(".#{note.line_code}").parent();
// ... and insert the note and the reply button after it
2012-11-17 20:34:52 +01:00
trEl.after("#{escape_javascript(render "notes/diff_notes_with_reply", notes: [note])}");
} else {
// instert new note before reply button
2012-11-17 20:24:12 +01:00
trRpl.before("#{escape_javascript(render "notes/diff_note", note: note)}");
}