diff options
author | Uģis Ozols <ugis.ozolss@gmail.com> | 2011-07-28 10:37:36 +0300 |
---|---|---|
committer | Uģis Ozols <ugis.ozolss@gmail.com> | 2011-07-28 10:37:36 +0300 |
commit | 9d23338de256b2f996810412457eb20e7f990b30 (patch) | |
tree | 1839a5a2374de44f2756ab334fc9dd0b674c9838 /app | |
parent | e0714c2ed05f285c952a88d7a586461712f1fae8 (diff) | |
download | refinerycms-blog-9d23338de256b2f996810412457eb20e7f990b30.tar.gz refinerycms-blog-9d23338de256b2f996810412457eb20e7f990b30.tar.bz2 refinerycms-blog-9d23338de256b2f996810412457eb20e7f990b30.zip |
Array is paginated differently.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/refinery/admin/blog/posts_controller.rb | 6 | ||||
-rw-r--r-- | app/models/refinery/blog_post.rb | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index ee73ee2..e3b0f3b 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -9,9 +9,9 @@ module Refinery :order => 'published_at DESC' def uncategorized - @blog_posts = Refinery::BlogPost.page(params[:page]) - .uncategorized - + @blog_posts = Kaminari.paginate_array(Refinery::BlogPost.uncategorized) + .page(params[:page]) + .per(Refinery::BlogPost.per_page) end def tags diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb index 5eb2a6f..f4bccf1 100644 --- a/app/models/refinery/blog_post.rb +++ b/app/models/refinery/blog_post.rb @@ -93,6 +93,11 @@ module Refinery def uncategorized BlogPost.live.reject { |p| p.categories.any? } end + + # how many items to show per page + def per_page + paginates_per Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + end end module ShareThis @@ -111,9 +116,6 @@ module Refinery end end end - - # how many items to show per page - paginates_per Refinery::Setting.find_or_set(:blog_posts_per_page, 10) end end |