diff options
-rw-r--r-- | app/controllers/blog/posts_controller.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 5ec6ec1..7eb167d 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -19,7 +19,7 @@ module Blog def show @blog_comment = BlogComment.new @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical? - + respond_with (@blog_post) do |format| format.html { present(@blog_post) } format.js { render :partial => 'post', :layout => false } @@ -42,7 +42,7 @@ module Blog else flash[:notice] = t('thank_you', :scope => 'blog.posts.comments') redirect_to blog_post_url(params[:id], - :anchor => "comment-#{@blog_comment.to_param}") + :anchor => "comment-#{@blog_comment.to_param}") end else render :action => 'show' @@ -55,17 +55,17 @@ module Blog @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') @blog_posts = BlogPost.live.by_year(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end respond_with (@blog_posts) end @@ -74,12 +74,12 @@ module Blog @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name @blog_posts = BlogPost.tagged_with(@tag_name).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end - protected + protected def find_blog_post unless (@blog_post = BlogPost.find(params[:id])).try(:live?) @@ -93,15 +93,15 @@ module Blog def find_all_blog_posts @blog_posts = BlogPost.live.includes(:comments, :categories).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end def find_tags @tags = BlogPost.tag_counts_on(:tags) end - + def canonical? ::Refinery.i18n_enabled? && ::Refinery::I18n.default_frontend_locale != ::Refinery::I18n.current_frontend_locale end |