aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/blog/categories_controller.rb7
-rw-r--r--app/controllers/blog/posts_controller.rb (renamed from app/controllers/blog_posts_controller.rb)29
-rw-r--r--app/controllers/blog_controller.rb15
3 files changed, 25 insertions, 26 deletions
diff --git a/app/controllers/blog/categories_controller.rb b/app/controllers/blog/categories_controller.rb
new file mode 100644
index 0000000..71ceec1
--- /dev/null
+++ b/app/controllers/blog/categories_controller.rb
@@ -0,0 +1,7 @@
+class Blog::CategoriesController < BlogController
+
+ def show
+ @category = BlogCategory.find(params[:id])
+ end
+
+end \ No newline at end of file
diff --git a/app/controllers/blog_posts_controller.rb b/app/controllers/blog/posts_controller.rb
index 73b9dfa..8a10604 100644
--- a/app/controllers/blog_posts_controller.rb
+++ b/app/controllers/blog/posts_controller.rb
@@ -1,15 +1,8 @@
-class BlogPostsController < ApplicationController
+class Blog::PostsController < BlogController
- before_filter :find_all_blog_posts, :find_all_blog_categories
- before_filter :find_page
+ before_filter :find_all_blog_posts
before_filter :find_blog_post, :only => [:show, :comment]
- def index
- # you can use meta fields from your model instead (e.g. browser_title)
- # by swapping @page for @blogs in the line below:
- present(@page)
- end
-
def show
@blog_comment = BlogComment.new
@@ -40,23 +33,7 @@ protected
end
def find_all_blog_posts
- 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("/blog")
+ @blog_posts = BlogPost.live
end
end
diff --git a/app/controllers/blog_controller.rb b/app/controllers/blog_controller.rb
new file mode 100644
index 0000000..0931cbd
--- /dev/null
+++ b/app/controllers/blog_controller.rb
@@ -0,0 +1,15 @@
+class BlogController < ApplicationController
+
+ before_filter :find_page, :find_all_blog_categories
+
+protected
+
+ def find_page
+ @page = Page.find_by_link_url("/blog")
+ end
+
+ def find_all_blog_categories
+ @blog_categories = BlogCategory.all
+ end
+
+end \ No newline at end of file