Make notes JS know which notes are new in a request

This commit is contained in:
Riyad Preukschas 2012-10-30 21:55:51 +01:00
parent ae067ee322
commit bd60a4ed40
3 changed files with 31 additions and 22 deletions

View file

@ -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?