aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/refinery/blog
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2012-01-17 16:56:03 +1300
committerPhilip Arndt <parndt@gmail.com>2012-01-17 16:56:24 +1300
commitb1e4fd00943a160f3eb6ce242463c0cc07a406fc (patch)
tree07fb750aa580b63d39c23589997956bf3a03594d /app/controllers/refinery/blog
parentb3a25c1b686d205fc6b8b409a8f90059ae6b934d (diff)
downloadrefinerycms-blog-b1e4fd00943a160f3eb6ce242463c0cc07a406fc.tar.gz
refinerycms-blog-b1e4fd00943a160f3eb6ce242463c0cc07a406fc.tar.bz2
refinerycms-blog-b1e4fd00943a160f3eb6ce242463c0cc07a406fc.zip
Fixed namespacing for Refinery conventions.
Diffstat (limited to 'app/controllers/refinery/blog')
-rw-r--r--app/controllers/refinery/blog/admin/comments_controller.rb18
-rw-r--r--app/controllers/refinery/blog/admin/posts_controller.rb18
-rw-r--r--app/controllers/refinery/blog/admin/settings_controller.rb10
-rw-r--r--app/controllers/refinery/blog/blog_controller.rb (renamed from app/controllers/refinery/blog/base_controller.rb)4
-rw-r--r--app/controllers/refinery/blog/categories_controller.rb6
-rw-r--r--app/controllers/refinery/blog/posts_controller.rb34
6 files changed, 45 insertions, 45 deletions
diff --git a/app/controllers/refinery/blog/admin/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb
index 3128e97..f9addaa 100644
--- a/app/controllers/refinery/blog/admin/comments_controller.rb
+++ b/app/controllers/refinery/blog/admin/comments_controller.rb
@@ -10,20 +10,20 @@ module Refinery
:order => 'published_at DESC'
def index
- @blog_comments = Refinery::Blog::Comment.unmoderated.page(params[:page])
+ @comments = Refinery::Blog::Comment.unmoderated.page(params[:page])
render :action => 'index'
end
def approved
unless params[:id].present?
- @blog_comments = Refinery::Blog::Comment.approved.page(params[:page])
+ @comments = Refinery::Blog::Comment.approved.page(params[:page])
render :action => 'index'
else
- @blog_comment = Refinery::Blog::Comment.find(params[:id])
- @blog_comment.approve!
- flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name)
+ @comment = Refinery::Blog::Comment.find(params[:id])
+ @comment.approve!
+ flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name)
redirect_to main_app.url_for(:action => params[:return_to] || 'index')
end
@@ -31,13 +31,13 @@ module Refinery
def rejected
unless params[:id].present?
- @blog_comments = Refinery::Blog::Comment.rejected.page(params[:page])
+ @comments = Refinery::Blog::Comment.rejected.page(params[:page])
render :action => 'index'
else
- @blog_comment = Refinery::Blog::Comment.find(params[:id])
- @blog_comment.reject!
- flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name)
+ @comment = Refinery::Blog::Comment.find(params[:id])
+ @comment.reject!
+ flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name)
redirect_to main_app.url_for(:action => params[:return_to] || 'index')
end
diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb
index 04ee663..2ed2b98 100644
--- a/app/controllers/refinery/blog/admin/posts_controller.rb
+++ b/app/controllers/refinery/blog/admin/posts_controller.rb
@@ -16,7 +16,7 @@ module Refinery
before_filter :check_category_ids, :only => :update
def uncategorized
- @blog_posts = Refinery::Blog::Post.uncategorized.page(params[:page])
+ @posts = Refinery::Blog::Post.uncategorized.page(params[:page])
end
def tags
@@ -35,21 +35,21 @@ module Refinery
end
def new
- @blog_post = ::Refinery::Blog::Post.new(:author => current_refinery_user)
+ @post = ::Refinery::Blog::Post.new(:author => current_refinery_user)
end
def create
# if the position field exists, set this object as last object, given the conditions of this class.
if Refinery::Blog::Post.column_names.include?("position")
- params[:blog_post].merge!({
+ params[:post].merge!({
:position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1)
})
end
- if (@blog_post = Refinery::Blog::Post.create(params[:blog_post])).valid?
+ if (@post = Refinery::Blog::Post.create(params[:post])).valid?
(request.xhr? ? flash.now : flash).notice = t(
'refinery.crudify.created',
- :what => "'#{@blog_post.title}'"
+ :what => "'#{@post.title}'"
)
unless from_dialog?
@@ -63,7 +63,7 @@ module Refinery
end
end
else
- render :text => "<script>parent.window.location = '#{admin_blog_posts_url}';</script>"
+ render :text => "<script>parent.window.location = '#{refinery_blog_admin_posts_url}';</script>"
end
else
unless request.xhr?
@@ -71,7 +71,7 @@ module Refinery
else
render :partial => "/refinery/admin/error_messages",
:locals => {
- :object => @blog_post,
+ :object => @post,
:include_object_name => true
}
end
@@ -80,11 +80,11 @@ module Refinery
protected
def find_all_categories
- @blog_categories = Refinery::Blog::Category.find(:all)
+ @categories = Refinery::Blog::Category.find(:all)
end
def check_category_ids
- params[:blog_post][:category_ids] ||= []
+ params[:post][:category_ids] ||= []
end
end
end
diff --git a/app/controllers/refinery/blog/admin/settings_controller.rb b/app/controllers/refinery/blog/admin/settings_controller.rb
index afa6b2b..34a8d00 100644
--- a/app/controllers/refinery/blog/admin/settings_controller.rb
+++ b/app/controllers/refinery/blog/admin/settings_controller.rb
@@ -11,9 +11,9 @@ module Refinery
flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients',
:recipients => Refinery::Blog::Comment::Notification.recipients)
unless request.xhr? or from_dialog?
- redirect_back_or_default(admin_blog_posts_path)
+ redirect_back_or_default(refinery_blog_admin_posts_path)
else
- render :text => "<script type='text/javascript'>parent.window.location = '#{admin_blog_posts_path}';</script>",
+ render :text => "<script type='text/javascript'>parent.window.location = '#{refinery_blog_admin_posts_path}';</script>",
:layout => false
end
end
@@ -22,7 +22,7 @@ module Refinery
def moderation
enabled = Refinery::Blog::Comment::Moderation.toggle!
unless request.xhr?
- redirect_back_or_default(admin_blog_posts_path)
+ redirect_back_or_default(refinery_blog_admin_posts_path)
else
render :json => {:enabled => enabled},
:layout => false
@@ -32,7 +32,7 @@ module Refinery
def comments
enabled = Refinery::Blog::Comment.toggle!
unless request.xhr?
- redirect_back_or_default(admin_blog_posts_path)
+ redirect_back_or_default(refinery_blog_admin_posts_path)
else
render :json => {:enabled => enabled},
:layout => false
@@ -42,7 +42,7 @@ module Refinery
def teasers
enabled = Refinery::Blog::Post.teaser_enabled_toggle!
unless request.xhr?
- redirect_back_or_default(admin_blog_posts_path)
+ redirect_back_or_default(refinery_blog_admin_posts_path)
else
render :json => {:enabled => enabled},
:layout => false
diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/blog_controller.rb
index 919c180..54a8b03 100644
--- a/app/controllers/refinery/blog/base_controller.rb
+++ b/app/controllers/refinery/blog/blog_controller.rb
@@ -1,7 +1,7 @@
module Refinery
module Blog
- class BaseController < ::ApplicationController
-
+ class BlogController < ::ApplicationController
+
include ControllerHelper
helper :'refinery/blog/posts'
diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb
index 60c8346..467726e 100644
--- a/app/controllers/refinery/blog/categories_controller.rb
+++ b/app/controllers/refinery/blog/categories_controller.rb
@@ -1,10 +1,10 @@
module Refinery
module Blog
- class CategoriesController < BaseController
+ class CategoriesController < BlogController
def show
- @blog_category = Refinery::Blog::Category.find(params[:id])
- @blog_posts = @blog_category.posts.live.includes(:comments, :categories).page(params[:page])
+ @category = Refinery::Blog::Category.find(params[:id])
+ @posts = @category.posts.live.includes(:comments, :categories).page(params[:page])
end
end
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb
index 1c8cffd..d680150 100644
--- a/app/controllers/refinery/blog/posts_controller.rb
+++ b/app/controllers/refinery/blog/posts_controller.rb
@@ -1,6 +1,6 @@
module Refinery
module Blog
- class PostsController < BaseController
+ class PostsController < BlogController
caches_page :index
@@ -12,41 +12,41 @@ module Refinery
def index
# Rss feeders are greedy. Let's give them every blog post instead of paginating.
- (@blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).all) if request.format.rss?
- respond_with (@blog_posts) do |format|
+ (@posts = Post.live.includes(:comments, :categories).all) if request.format.rss?
+ respond_with (@posts) do |format|
format.html
format.rss
end
end
def show
- @blog_comment = Refinery::Blog::Comment.new
+ @comment = Comment.new
@canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical?
- respond_with (@blog_post) do |format|
- format.html { present(@blog_post) }
+ respond_with (@post) do |format|
+ format.html { present(@post) }
format.js { render :partial => 'post', :layout => false }
end
end
def comment
- if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
- if Refinery::Blog::Comment::Moderation.enabled? or @blog_comment.ham?
+ if (@comment = @post.comments.create(params[comment])).valid?
+ if Comment::Moderation.enabled? or @comment.ham?
begin
- Refinery::Blog::CommentMailer.notification(@blog_comment, request).deliver
+ CommentMailer.notification(@comment, request).deliver
rescue
logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n"
end
end
- if Refinery::Blog::Comment::Moderation.enabled?
+ if Comment::Moderation.enabled?
flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments')
- redirect_to main_app.blog_post_url(params[:id])
+ redirect_to main_app.refinery_blog_post_url(params[:id])
else
flash[:notice] = t('thank_you', :scope => 'refinery.blog.posts.comments')
- redirect_to main_app.blog_post_url(params[:id],
- :anchor => "comment-#{@blog_comment.to_param}")
+ redirect_to main_app.refinery_blog_post_url(params[:id],
+ :anchor => "comment-#{@comment.to_param}")
end
else
render :action => 'show'
@@ -58,20 +58,20 @@ module Refinery
date = "#{params[:month]}/#{params[:year]}"
@archive_date = Time.parse(date)
@date_title = @archive_date.strftime('%B %Y')
- @blog_posts = Refinery::Blog::Post.live.by_archive(@archive_date).page(params[:page])
+ @posts = Post.live.by_archive(@archive_date).page(params[:page])
else
date = "01/#{params[:year]}"
@archive_date = Time.parse(date)
@date_title = @archive_date.strftime('%Y')
- @blog_posts = Refinery::Blog::Post.live.by_year(@archive_date).page(params[:page])
+ @posts = Post.live.by_year(@archive_date).page(params[:page])
end
- respond_with (@blog_posts)
+ respond_with (@posts)
end
def tagged
@tag = ActsAsTaggableOn::Tag.find(params[:tag_id])
@tag_name = @tag.name
- @blog_posts = Refinery::Blog::Post.tagged_with(@tag_name).page(params[:page])
+ @posts = Post.tagged_with(@tag_name).page(params[:page])
end
def canonical?