aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2010-08-26 17:41:32 +1200
committerPhilip Arndt <parndt@gmail.com>2010-08-26 17:41:32 +1200
commit5cb85902866dfc0f64885a76ce38f23dd1f89d53 (patch)
treeb9d2110ee59a9bd301ba5648083f5138b17ed0f8 /app/controllers
parentda6b5e1f572960533f31026981df57f2d59d1b05 (diff)
downloadrefinerycms-blog-5cb85902866dfc0f64885a76ce38f23dd1f89d53.tar.gz
refinerycms-blog-5cb85902866dfc0f64885a76ce38f23dd1f89d53.tar.bz2
refinerycms-blog-5cb85902866dfc0f64885a76ce38f23dd1f89d53.zip
frontend markup and categories.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/blog_posts_controller.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/app/controllers/blog_posts_controller.rb b/app/controllers/blog_posts_controller.rb
index 95169c0..7ddb7b8 100644
--- a/app/controllers/blog_posts_controller.rb
+++ b/app/controllers/blog_posts_controller.rb
@@ -1,6 +1,6 @@
class BlogPostsController < ApplicationController
- before_filter :find_all_blog_posts
+ before_filter :find_all_blog_posts, :find_all_blog_categories
before_filter :find_page
def index
@@ -20,11 +20,23 @@ class BlogPostsController < ApplicationController
protected
def find_all_blog_posts
- @blog_posts = BlogPost.live
+ unless params[:category_id].present?
+ @blog_posts = BlogPost.live
+ else
+ if (category = BlogCategory.find(params[:category_id])).present?
+ @blog_posts = category.posts
+ else
+ error_404
+ end
+ end
+ end
+
+ def find_all_blog_categories
+ @blog_categories = BlogCategory.all
end
def find_page
- @page = Page.find_by_link_url("/blogs")
+ @page = Page.find_by_link_url("/blog")
end
end