aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/refinery/admin/blog/comments_controller.rb21
-rw-r--r--app/controllers/refinery/admin/blog/posts_controller.rb20
-rw-r--r--app/controllers/refinery/blog/posts_controller.rb7
3 files changed, 28 insertions, 20 deletions
diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb
index 9f78caa..f14e8eb 100644
--- a/app/controllers/refinery/admin/blog/comments_controller.rb
+++ b/app/controllers/refinery/admin/blog/comments_controller.rb
@@ -2,37 +2,44 @@ module Refinery
module Admin
module Blog
class CommentsController < ::Admin::BaseController
+
+ cache_sweeper Refinery::BlogSweeper
crudify :'refinery/blog_comment',
:title_attribute => :name,
:order => 'published_at DESC'
def index
- @blog_comments = Refinery::BlogComment.unmoderated
+ @blog_comments = Refinery::BlogComment.unmoderated.page(params[:page])
+
render :action => 'index'
end
def approved
unless params[:id].present?
- @blog_comments = Refinery::BlogComment.approved
+ @blog_comments = Refinery::BlogComment.approved.page(params[:page])
+
render :action => 'index'
else
@blog_comment = Refinery::BlogComment.find(params[:id])
@blog_comment.approve!
- flash[:notice] = t('approved', :scope => 'admin.blog.comments', :author => @blog_comment.name)
- redirect_to :action => params[:return_to] || 'index'
+ flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name)
+
+ redirect_to main_app.url_for(:action => params[:return_to] || 'index')
end
end
def rejected
unless params[:id].present?
- @blog_comments = Refinery::BlogComment.rejected
+ @blog_comments = Refinery::BlogComment.rejected.page(params[:page])
+
render :action => 'index'
else
@blog_comment = Refinery::BlogComment.find(params[:id])
@blog_comment.reject!
- flash[:notice] = t('rejected', :scope => 'admin.blog.comments', :author => @blog_comment.name)
- redirect_to :action => params[:return_to] || 'index'
+ flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name)
+
+ redirect_to main_app.url_for(:action => params[:return_to] || 'index')
end
end
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)
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb
index 167aef3..aa7d45e 100644
--- a/app/controllers/refinery/blog/posts_controller.rb
+++ b/app/controllers/refinery/blog/posts_controller.rb
@@ -1,6 +1,9 @@
module Refinery
module Blog
class PostsController < BlogController
+
+ caches_page :index
+ # cache_sweeper Refinery::BlogSweeper, :only => [:comment]
before_filter :find_all_blog_posts, :except => [:archive]
before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
@@ -38,10 +41,10 @@ module Refinery
if Refinery::BlogComment::Moderation.enabled?
flash[:notice] = t('thank_you_moderated', :scope => 'blog.posts.comments')
- redirect_to blog_post_url(params[:id])
+ redirect_to main_app.blog_post_url(params[:id])
else
flash[:notice] = t('thank_you', :scope => 'blog.posts.comments')
- redirect_to blog_post_url(params[:id],
+ redirect_to main_app.blog_post_url(params[:id],
:anchor => "comment-#{@blog_comment.to_param}")
end
else