]> cat aescling's git repositories - mastodon.git/commitdiff
Add "next" pagination to public profiles
authorEugen Rochko <eugen@zeonfederated.com>
Sat, 3 Dec 2016 18:30:13 +0000 (19:30 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 3 Dec 2016 18:30:13 +0000 (19:30 +0100)
app/controllers/accounts_controller.rb
app/views/accounts/show.html.haml
app/views/admin/accounts/index.html.haml

index b0e5a8320174764c3959abcfd6326852c8bee31f..46231dd9714c8cb38ec2e1e4441ec8db8d2f7eeb 100644 (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
index c04faa32f90f7514ae0c2067e52f193be4da4b14..db8e45e6b95c2fedb24c9ed4cfe62e9ca3919683 100644 (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'
index aac2f99a8a5da82c5faf4abecc768ca0998c19e8..32474c2a4ff0bb2a48b5b27e703c725e87a161cb 100644 (file)
@@ -16,4 +16,5 @@
             %i.fa.fa-check
           - else
             %i.fa.fa-times
+
 = will_paginate @accounts, pagination_options