From c20af32ae4adb1ec891e32ea048ae06ef4c7bc5f Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Sun, 2 Dec 2012 23:14:56 +0100 Subject: Pull together and rename Notes partials --- app/views/notes/index.js.haml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'app/views/notes/index.js.haml') diff --git a/app/views/notes/index.js.haml b/app/views/notes/index.js.haml index ae70dcad289..f0826100fbf 100644 --- a/app/views/notes/index.js.haml +++ b/app/views/notes/index.js.haml @@ -1,18 +1,15 @@ - unless @notes.blank? + var notesHtml = "#{escape_javascript(render 'notes/notes')}"; - new_note_ids = @notes.map(&:id) - if loading_more_notes? - :plain - NoteList.appendMoreNotes(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}"); + NoteList.appendMoreNotes(#{new_note_ids}, notesHtml); - elsif loading_new_notes? - :plain - NoteList.replaceNewNotes(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}"); + NoteList.replaceNewNotes(#{new_note_ids}, notesHtml); - else - :plain - NoteList.setContent(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}"); + NoteList.setContent(#{new_note_ids}, notesHtml); - else - if loading_more_notes? - :plain - NoteList.finishedLoadingMore(); + NoteList.finishedLoadingMore(); -- cgit v1.2.1