1
0
Fork 0
forked from fedi/mastodon

Add "next" pagination to public profiles

This commit is contained in:
Eugen Rochko 2016-12-03 19:30:13 +01:00
parent ec44cff9a2
commit 5abf64d647
3 changed files with 6 additions and 3 deletions

View file

@ -9,12 +9,12 @@ class AccountsController < ApplicationController
def show
respond_to do |format|
format.html do
@statuses = @account.statuses.order('id desc').paginate_by_max_id(20, params[:max_id || nil])
@statuses = @account.statuses.order('id desc').paginate_by_max_id(20, params[:max_id], params[:since_id])
@statuses = cache_collection(@statuses, Status)
end
format.atom do
@entries = @account.stream_entries.order('id desc').with_includes.paginate_by_max_id(20, params[:max_id] || nil)
@entries = @account.stream_entries.order('id desc').with_includes.paginate_by_max_id(20, params[:max_id], params[:since_id])
end
end
end

View file

@ -14,4 +14,6 @@
.activity-stream
= render partial: 'stream_entries/status', collection: @statuses, as: :status
= id_paginate account_url(@account), 20, @statuses
.pagination
- if @statuses.size == 20
= link_to safe_join([t('pagination.next'), fa_icon('chevron-right')], ' '), account_url(@account, max_id: @statuses.last.id), class: 'next_page', rel: 'next'

View file

@ -16,4 +16,5 @@
%i.fa.fa-check
- else
%i.fa.fa-times
= will_paginate @accounts, pagination_options