Make notes JS know which notes are new in a request
This commit is contained in:
parent
ae067ee322
commit
bd60a4ed40
3 changed files with 31 additions and 22 deletions
|
@ -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?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue