_create_diff_note.js.haml 525 Bytes
- if note.valid?
  :plain
    // hide and reset the form
    var form = $("form[rel='#{note.discussion_id}']");
    var row = form.closest("tr");

    // is this the first note?
    if (row.is(".js-temp-notes-holder")) {
      // insert the note and the reply button after it
      row.after("#{escape_javascript(render "notes/diff_notes_with_reply", notes: [note])}");
    } else {
      // instert new note before reply button
      row.find(".notes").append("#{escape_javascript(render "notes/note", note: note)}");
    }