diff options
author | Joe Sak <joe@joesak.com> | 2010-11-18 10:52:10 -0600 |
---|---|---|
committer | Joe Sak <joe@joesak.com> | 2010-11-18 10:52:10 -0600 |
commit | dc3cbaa0918c5194ae0f1e80024611c614be612f (patch) | |
tree | 148ec2e27b58295bfbfda2be12863d398d026713 /app/controllers/blog | |
parent | c610fee93b9e20e083c68d99ee941c6b4f507cf0 (diff) | |
download | refinerycms-blog-dc3cbaa0918c5194ae0f1e80024611c614be612f.tar.gz refinerycms-blog-dc3cbaa0918c5194ae0f1e80024611c614be612f.tar.bz2 refinerycms-blog-dc3cbaa0918c5194ae0f1e80024611c614be612f.zip |
Archive listing, views, helpers
@page added to PostsController
TODO: language file stuff -- I left comments in the view files where these belong. I don't know how to test them from here
Diffstat (limited to 'app/controllers/blog')
-rw-r--r-- | app/controllers/blog/posts_controller.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 1d8a0b5..071bc68 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -1,6 +1,7 @@ class Blog::PostsController < BlogController - - before_filter :find_all_blog_posts + + before_filter :find_page + before_filter :find_all_blog_posts, :except => [:archive] before_filter :find_blog_post, :only => [:show, :comment] def index @@ -41,6 +42,15 @@ class Blog::PostsController < BlogController render :action => 'show' end end + + def archive + date = "#{params[:month]}/#{params[:year]}" + @archive_date = Time.parse(date) + @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({ + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) + end protected @@ -54,5 +64,9 @@ protected :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) }) end + + def find_page + @page = Page.find_by_link_url('/blog') + end end |