summaryrefslogtreecommitdiff
path: root/app/views/notes/create.js.haml
blob: c573d406b73d4196459756d5d9e2865fe4873278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
- if @note.valid?
  var noteHtml = "#{escape_javascript(render "notes/note", note: @note)}";

  - if note_for_main_target?(@note)
    - if @note.for_wall?
      NoteList.appendNewWallNote(#{@note.id}, noteHtml);
    - else
      NoteList.appendNewNote(#{@note.id}, noteHtml);
  - else
    :plain
      var firstDiscussionNoteHtml = "#{escape_javascript(render "notes/diff_notes_with_reply", notes: [@note])}";
      NoteList.appendNewDiscussionNote("#{@note.discussion_id}",
                                       firstDiscussionNoteHtml,
                                       noteHtml);

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