aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorKyle Wilkinson <kai@wikyd.org>2011-06-13 18:06:26 -0700
committerKyle Wilkinson <kai@wikyd.org>2011-06-13 18:06:26 -0700
commit9310b4176047dc24fce5841237441882ffee2e2f (patch)
tree14307099094f7853b268517ad1198e6c963a0f87 /app
parentb91b381e8eb6e5dc572ea4e53b138caba1a011fa (diff)
downloadrefinerycms-blog-9310b4176047dc24fce5841237441882ffee2e2f.tar.gz
refinerycms-blog-9310b4176047dc24fce5841237441882ffee2e2f.tar.bz2
refinerycms-blog-9310b4176047dc24fce5841237441882ffee2e2f.zip
Modify the category view of the blog to show a paged view, rather than all blog posts.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/blog/categories_controller.rb4
-rw-r--r--app/views/blog/categories/show.html.erb13
2 files changed, 10 insertions, 7 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..caecbfd 100644
--- a/app/views/blog/categories/show.html.erb
+++ b/app/views/blog/categories/show.html.erb
@@ -1,14 +1,13 @@
<% 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') %>
- </p>
+ <p><%= t('.no_blog_articles_yet') %></p>
<% end %>
<% end %>