Namespace BlogControllerHelper to Blog::ControllerHelper

This commit is contained in:
Jamie Winsor 2011-09-19 18:43:09 -07:00
parent c40eb83af3
commit de4cc6b9ef
3 changed files with 31 additions and 29 deletions

View file

@ -1,7 +1,7 @@
module Refinery
class BlogController < ::ApplicationController
include BlogControllerHelper
include Blog::ControllerHelper
helper :'refinery/blog_posts'
before_filter :find_page, :find_all_blog_categories

View file

@ -0,0 +1,30 @@
module Refinery
module Blog
module ControllerHelper
protected
def find_blog_post
unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?)
if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog")
@blog_post = Refinery::BlogPost.find(params[:id])
else
error_404
end
end
end
def find_all_blog_posts
@blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page])
end
def find_tags
@tags = Refinery::BlogPost.tag_counts_on(:tags)
end
def find_all_blog_categories
@blog_categories = Refinery::BlogCategory.all
end
end
end
end

View file

@ -1,28 +0,0 @@
module Refinery
module BlogControllerHelper
protected
def find_blog_post
unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?)
if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog")
@blog_post = Refinery::BlogPost.find(params[:id])
else
error_404
end
end
end
def find_all_blog_posts
@blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page])
end
def find_tags
@tags = Refinery::BlogPost.tag_counts_on(:tags)
end
def find_all_blog_categories
@blog_categories = Refinery::BlogCategory.all
end
end
end