Completely redo loading of notes with JS
This commit is contained in:
parent
1416401753
commit
e802d00996
5 changed files with 134 additions and 100 deletions
|
@ -5,7 +5,8 @@
|
|||
$('.note-form-holder #preview-link').text('Preview');
|
||||
$('.note-form-holder #preview-note').hide();
|
||||
$('.note-form-holder').show();
|
||||
NoteList.prepend(#{note.id}, "#{escape_javascript(render partial: "notes/show", locals: {note: note})}");
|
||||
NoteList.appendNewNote(#{note.id}, "#{escape_javascript(render "notes/show", note: note)}");
|
||||
|
||||
- else
|
||||
:plain
|
||||
$(".note-form-holder").replaceWith("#{escape_javascript(render('form'))}");
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
- unless @notes.blank?
|
||||
- if params[:last_id]
|
||||
- if loading_more_notes?
|
||||
:plain
|
||||
NoteList.replace("#{escape_javascript(render(partial: 'notes/notes_list'))}");
|
||||
NoteList.appendMoreNotes(#{@notes.last.id}, "#{escape_javascript(render 'notes/notes_list')}");
|
||||
|
||||
- elsif params[:first_id]
|
||||
- elsif loading_new_notes?
|
||||
:plain
|
||||
NoteList.append(#{@notes.last.id}, "#{escape_javascript(render(partial: 'notes/notes_list'))}");
|
||||
NoteList.replaceNewNotes("#{escape_javascript(render 'notes/notes_list')}");
|
||||
|
||||
- else
|
||||
:plain
|
||||
NoteList.setContent(#{@notes.last.id}, #{@notes.first.id}, "#{escape_javascript(render(partial: 'notes/notes_list'))}");
|
||||
NoteList.setContent(#{@notes.last.id}, "#{escape_javascript(render 'notes/notes_list')}");
|
||||
|
||||
- else
|
||||
- if params[:first_id]
|
||||
- if loading_more_notes?
|
||||
:plain
|
||||
NoteList.append(#{params[:first_id]}, "");
|
||||
NoteList.finishedLoadingMore();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue