From 6212e60f9e4d144f9a136f6c82b33abd47ddb237 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 2 Sep 2011 16:01:58 -0700 Subject: 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 --- .../refinery/admin/blog/posts_controller.rb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'app/controllers/refinery/admin/blog/posts_controller.rb') 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) -- cgit v1.2.3