aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorAdrien Coquio <adrien.coquio@gmail.com>2012-06-03 21:37:41 +0200
committerPhilip Arndt <parndt@gmail.com>2012-06-09 11:19:38 +1200
commitd0c249af2a2e630ac993eb23a691ef996613b55f (patch)
tree6992cf3816a6f5b1e022637a6780a7d24f1753cf /app/helpers
parent7743fab73a5c60d9f5f0cf2ce65a3f0914b1376f (diff)
downloadrefinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.tar.gz
refinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.tar.bz2
refinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.zip
Added i18n support to models through globalize3.
* Added Post translation * Added Category translation * Use friendly_id globalize with category * Added migrate_data option on migrations for translations * Use Refinery locale instead of I18n * Refactored duplicate locale_picker partial * Removed useless .all call * Use presence instead if / blank? * Added with_globalize scopes when loading posts of one category * Use Globalize when creating post factory * Fix failing specs by creating blog posts/categories using needed locale.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/refinery/blog/controller_helper.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb
index bf4926b..87d5447 100644
--- a/app/helpers/refinery/blog/controller_helper.rb
+++ b/app/helpers/refinery/blog/controller_helper.rb
@@ -1,11 +1,11 @@
module Refinery
module Blog
module ControllerHelper
-
+
protected
-
+
def find_blog_post
- unless (@post = Refinery::Blog::Post.find(params[:id])).try(:live?)
+ unless (@post = Refinery::Blog::Post.with_globalize.find(params[:id])).try(:live?)
if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog")
@post = Refinery::Blog::Post.find(params[:id])
else
@@ -13,16 +13,16 @@ module Refinery
end
end
end
-
+
def find_all_blog_posts
- @posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page])
+ @posts = Refinery::Blog::Post.live.includes(:comments, :categories).with_globalize.page(params[:page])
end
def find_tags
@tags = Refinery::Blog::Post.tag_counts_on(:tags)
end
def find_all_blog_categories
- @categories = Refinery::Blog::Category.all
+ @categories = Refinery::Blog::Category.translated
end
end
end