BigW Consortium Gitlab

create.js.haml 735 Bytes
Newer Older
1 2 3 4
- if @note.valid?
  var noteHtml = "#{escape_javascript(render "notes/note", note: @note)}";

  - if note_for_main_target?(@note)
5
    NoteList.appendNewNote(#{@note.id}, noteHtml);
6
  - else
7 8 9 10 11
    :plain
      var firstDiscussionNoteHtml = "#{escape_javascript(render "notes/diff_notes_with_reply", notes: [@note])}";
      NoteList.appendNewDiscussionNote("#{@note.discussion_id}",
                                       firstDiscussionNoteHtml,
                                       noteHtml);
12

13
- else
14 15 16 17
  var errorsHtml = "#{escape_javascript(render 'notes/form_errors', note: @note)}";
  - if note_for_main_target?(@note)
    NoteList.errorsOnForm(errorsHtml);
  - else
18
    NoteList.errorsOnForm(errorsHtml, "#{@note.discussion_id}");