fixed pagination for real
This commit is contained in:
parent
e3bc0d6300
commit
cb606f942a
|
@ -2,6 +2,10 @@ class InboxController < ApplicationController
|
|||
before_filter :authenticate_user!
|
||||
|
||||
def show
|
||||
@inbox = Inbox.where(user: current_user).order(:created_at).reverse_order
|
||||
@inbox = Inbox.where(user: current_user).order(:created_at).reverse_order.paginate(page: params[:page])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
- @inbox.each do |i|
|
||||
= render 'inbox/entry', i: i
|
||||
|
||||
- if @inbox.empty?
|
||||
Nothing to see here.
|
||||
|
||||
#pagination= will_paginate @inbox, renderer: BootstrapPagination::Rails, page_links: false
|
||||
|
||||
- if @inbox.next_page
|
||||
%button#load-more-btn.btn.btn-default{type: :button, data: { current_page: @inbox.current_page }}
|
||||
Load more
|
||||
|
||||
- if @inbox.empty?
|
||||
|
||||
Nothing to see here.
|
||||
.col-md-9.col-xs-12.col-sm-9.visible-xs
|
||||
= render 'inbox/sidebar'
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
$('#timeline').append('<% @timeline.each do |answer|
|
||||
%><%= j render 'inbox/entry', a: answer
|
||||
$('#entries').append('<% @inbox.each do |i|
|
||||
%><%= j render 'inbox/entry', i: i
|
||||
%><% end %>');
|
||||
<% if @timeline.next_page %>
|
||||
$('#pagination').html('<%= j will_paginate @inbox, renderer: BootstrapPagination::Rails, page_links: false %>');
|
||||
<% else %>
|
||||
$('#pagination, #load-more-btn').remove();
|
||||
<% end %>
|
||||
<% @inbox.update_all(new: false) %>
|
Loading…
Reference in New Issue