aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/refinery
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/refinery')
-rw-r--r--app/helpers/refinery/blog_controller_helper.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/helpers/refinery/blog_controller_helper.rb b/app/helpers/refinery/blog_controller_helper.rb
new file mode 100644
index 0000000..2edc2f6
--- /dev/null
+++ b/app/helpers/refinery/blog_controller_helper.rb
@@ -0,0 +1,28 @@
+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