diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/blog/categories_controller.rb | 4 | ||||
-rw-r--r-- | app/views/blog/categories/show.html.erb | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/app/controllers/blog/categories_controller.rb b/app/controllers/blog/categories_controller.rb index 4795e99..35a87c3 100644 --- a/app/controllers/blog/categories_controller.rb +++ b/app/controllers/blog/categories_controller.rb @@ -2,6 +2,10 @@ class Blog::CategoriesController < BlogController def show @category = BlogCategory.find(params[:id]) + @blog_posts = @category.posts.live.includes(:comments, :categories).paginate({ + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end end diff --git a/app/views/blog/categories/show.html.erb b/app/views/blog/categories/show.html.erb index 324c0fe..40444ec 100644 --- a/app/views/blog/categories/show.html.erb +++ b/app/views/blog/categories/show.html.erb @@ -1,10 +1,11 @@ <% content_for :body_content_title, @category.title %> <% content_for :body_content_left do %> - <% if @category.posts.any? %> - <article id="blog_posts"> - <%= render :partial => "/blog/shared/post", :collection => @category.posts %> - </article> + <% if @blog_posts.any? %> + <section id="blog_posts"> + <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> + <%= will_paginate @blog_posts %> + </section> <% else %> <p> <%= t('.no_posts') %> |