From bd60a4ed40ca52fd23e027de8f30e2f094eb6e5c Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Tue, 30 Oct 2012 21:55:51 +0100 Subject: Make notes JS know which notes are new in a request --- app/views/notes/index.js.haml | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 99da619c649..cf46af6523b 100644 --- a/app/views/notes/index.js.haml +++ b/app/views/notes/index.js.haml @@ -1,15 +1,16 @@ - unless @notes.blank? + - new_note_ids = @notes.map(&:id) - if loading_more_notes? :plain - NoteList.appendMoreNotes(#{@notes.last.id}, "#{escape_javascript(render 'notes/notes')}"); + NoteList.appendMoreNotes(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}"); - elsif loading_new_notes? :plain - NoteList.replaceNewNotes("#{escape_javascript(render 'notes/notes')}"); + NoteList.replaceNewNotes(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}"); - else :plain - NoteList.setContent(#{@notes.first.id}, #{@notes.last.id}, "#{escape_javascript(render 'notes/notes')}"); + NoteList.setContent(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}"); - else - if loading_more_notes? -- cgit v1.2.1