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

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

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