aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/refinery
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/refinery')
-rw-r--r--app/controllers/refinery/blog/admin/posts_controller.rb7
-rw-r--r--app/controllers/refinery/blog/categories_controller.rb2
-rw-r--r--app/controllers/refinery/blog/posts_controller.rb4
3 files changed, 9 insertions, 4 deletions
diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb
index b379a24..e48c00d 100644
--- a/app/controllers/refinery/blog/admin/posts_controller.rb
+++ b/app/controllers/refinery/blog/admin/posts_controller.rb
@@ -6,7 +6,8 @@ module Refinery
cache_sweeper Refinery::BlogSweeper
crudify :'refinery/blog/post',
- :order => 'published_at DESC'
+ :order => 'published_at DESC',
+ :include => [:translations]
before_filter :find_all_categories,
:only => [:new, :edit, :create, :update]
@@ -77,6 +78,10 @@ module Refinery
end
protected
+ def find_post
+ @post = Refinery::Blog::Post.find_by_slug_or_id(params[:id])
+ end
+
def find_all_categories
@categories = Refinery::Blog::Category.find(:all)
end
diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb
index 467726e..23a835a 100644
--- a/app/controllers/refinery/blog/categories_controller.rb
+++ b/app/controllers/refinery/blog/categories_controller.rb
@@ -4,7 +4,7 @@ module Refinery
def show
@category = Refinery::Blog::Category.find(params[:id])
- @posts = @category.posts.live.includes(:comments, :categories).page(params[:page])
+ @posts = @category.posts.live.includes(:comments, :categories).with_globalize.page(params[:page])
end
end
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb
index caa46ec..bb242fd 100644
--- a/app/controllers/refinery/blog/posts_controller.rb
+++ b/app/controllers/refinery/blog/posts_controller.rb
@@ -12,7 +12,7 @@ module Refinery
def index
# Rss feeders are greedy. Let's give them every blog post instead of paginating.
- (@posts = Post.live.includes(:comments, :categories).all) if request.format.rss?
+ (@posts = Post.live.includes(:comments, :categories).with_globalize) if request.format.rss?
respond_with (@posts) do |format|
format.html
format.rss
@@ -22,7 +22,7 @@ module Refinery
def show
@comment = Comment.new
- @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical?
+ @canonical = refinery.url_for(:locale => Refinery::I18n.current_frontend_locale) if canonical?
@post.increment!(:access_count, 1)