aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/refinery/admin/blog/posts_controller.rb
diff options
context:
space:
mode:
authorJamie Winsor <jamie@enmasse.com>2011-09-02 16:01:58 -0700
committerJamie Winsor <jamie@enmasse.com>2011-09-03 21:55:30 -0700
commit6212e60f9e4d144f9a136f6c82b33abd47ddb237 (patch)
tree3ba02acc7861ef51045f0196dff6bac9efda40d5 /app/controllers/refinery/admin/blog/posts_controller.rb
parent80ca7c1bf99befac70803309e542a4db54f1f198 (diff)
downloadrefinerycms-blog-6212e60f9e4d144f9a136f6c82b33abd47ddb237.tar.gz
refinerycms-blog-6212e60f9e4d144f9a136f6c82b33abd47ddb237.tar.bz2
refinerycms-blog-6212e60f9e4d144f9a136f6c82b33abd47ddb237.zip
index action of blog post controller now caches and sweeps on changes
fix various views which were broken and untested with rails-3-1 upgrade add request spec tests for admin blog comments Factory is now FactoryGirl Fix multiple issues around listing unmoderated comments use cleaner definitions to set per_page willpaginate attribute on models update all paginate calls to use new arel representation reorganize filter sections to be located at top of controller modify uncategorized class method to activerecord scope and perform a left outer join instead of iterate through an array to find uncategorized posts move request specs into their proper places update guardfile to ensure that request specs get run when their respective controllers are modified Fix show action for AdminBlogComments and added test Fix redirection link after approving or rejecting a comment
Diffstat (limited to 'app/controllers/refinery/admin/blog/posts_controller.rb')
-rw-r--r--app/controllers/refinery/admin/blog/posts_controller.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb
index 548f8c9..17ebe87 100644
--- a/app/controllers/refinery/admin/blog/posts_controller.rb
+++ b/app/controllers/refinery/admin/blog/posts_controller.rb
@@ -1,18 +1,21 @@
-require 'will_paginate/array'
-
module Refinery
module Admin
module Blog
class PostsController < ::Admin::BaseController
-
+
+ cache_sweeper Refinery::BlogSweeper
crudify :'refinery/blog_post',
:title_attribute => :title,
:order => 'published_at DESC'
+
+ before_filter :find_all_categories,
+ :only => [:new, :edit, :create, :update]
+
+ before_filter :check_category_ids, :only => :update
def uncategorized
- @blog_posts = Refinery::BlogPost.uncategorized.paginate(:page => params[:page],
- :per_page => Refinery::BlogPost.per_page)
+ @blog_posts = Refinery::BlogPost.uncategorized.page(params[:page])
end
def tags
@@ -71,7 +74,7 @@ module Refinery
unless request.xhr?
render :action => 'new'
else
- render :partial => "/shared/admin/error_messages",
+ render :partial => "/refinery/admin/error_messages",
:locals => {
:object => @blog_post,
:include_object_name => true
@@ -80,11 +83,6 @@ module Refinery
end
end
- before_filter :find_all_categories,
- :only => [:new, :edit, :create, :update]
-
- before_filter :check_category_ids, :only => :update
-
protected
def find_all_categories
@blog_categories = Refinery::BlogCategory.find(:all)