aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2012-07-06 12:52:10 -0700
committerPhilip Arndt <parndt@gmail.com>2012-07-06 12:52:10 -0700
commit213f7f20ef83736f2f63cc36b1a2b7a87eba10d6 (patch)
tree13a7bcb43ea3321839b71ac340a4c2ea02bff8a1 /app
parente41a230b3bb30e3ccf92cce14a692bf204ec28c7 (diff)
parentdd3480f8dcf96038c73e00df872987ea9a15eb2b (diff)
downloadrefinerycms-blog-213f7f20ef83736f2f63cc36b1a2b7a87eba10d6.tar.gz
refinerycms-blog-213f7f20ef83736f2f63cc36b1a2b7a87eba10d6.tar.bz2
refinerycms-blog-213f7f20ef83736f2f63cc36b1a2b7a87eba10d6.zip
Merge pull request #251 from resolve/split_approved_rejected_actions
Split rejected and approved comment actions into separate controller act...
Diffstat (limited to 'app')
-rw-r--r--app/controllers/refinery/blog/admin/comments_controller.rb36
-rw-r--r--app/views/refinery/blog/admin/comments/_comment.html.erb6
-rw-r--r--app/views/refinery/blog/admin/comments/show.html.erb10
3 files changed, 28 insertions, 24 deletions
diff --git a/app/controllers/refinery/blog/admin/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb
index 18246ee..ce4ac70 100644
--- a/app/controllers/refinery/blog/admin/comments_controller.rb
+++ b/app/controllers/refinery/blog/admin/comments_controller.rb
@@ -16,31 +16,31 @@ module Refinery
end
def approved
- unless params[:id].present?
- @comments = Refinery::Blog::Comment.approved.page(params[:page])
+ @comments = Refinery::Blog::Comment.approved.page(params[:page])
- render :index
- else
- @comment = Refinery::Blog::Comment.find(params[:id])
- @comment.approve!
- flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name)
+ render :index
+ end
+
+ def approve
+ @comment = Refinery::Blog::Comment.find(params[:id])
+ @comment.approve!
+ flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name)
- redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil)
- end
+ redirect_to refinery.blog_admin_comments_path
end
def rejected
- unless params[:id].present?
- @comments = Refinery::Blog::Comment.rejected.page(params[:page])
+ @comments = Refinery::Blog::Comment.rejected.page(params[:page])
+
+ render :index
+ end
- render :index
- else
- @comment = Refinery::Blog::Comment.find(params[:id])
- @comment.reject!
- flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name)
+ def reject
+ @comment = Refinery::Blog::Comment.find(params[:id])
+ @comment.reject!
+ flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name)
- redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil)
- end
+ redirect_to refinery.blog_admin_comments_path
end
end
diff --git a/app/views/refinery/blog/admin/comments/_comment.html.erb b/app/views/refinery/blog/admin/comments/_comment.html.erb
index c007294..fe72030 100644
--- a/app/views/refinery/blog/admin/comments/_comment.html.erb
+++ b/app/views/refinery/blog/admin/comments/_comment.html.erb
@@ -11,10 +11,12 @@
<%= link_to refinery_icon_tag('zoom.png'), refinery.blog_admin_comment_path(comment),
:title => t('.read') %>
<%= link_to refinery_icon_tag("cross.png"),
- refinery.rejected_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
+ refinery.reject_blog_admin_comment_path(comment),
+ :method => :post,
:title => t('.reject') unless comment.rejected? %>
<%= link_to refinery_icon_tag("tick.png"),
- refinery.approved_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
+ refinery.approve_blog_admin_comment_path(comment),
+ :method => :post,
:title => t('.approve') unless comment.approved? %>
</span>
</li>
diff --git a/app/views/refinery/blog/admin/comments/show.html.erb b/app/views/refinery/blog/admin/comments/show.html.erb
index 2246c2f..5cd34f9 100644
--- a/app/views/refinery/blog/admin/comments/show.html.erb
+++ b/app/views/refinery/blog/admin/comments/show.html.erb
@@ -9,12 +9,14 @@
<%= link_to t('.back'), refinery.blog_admin_comments_path, :class => "back_icon" %>
</li>
<li>
- <%= link_to t('.reject'), refinery.rejected_blog_admin_comment_path(@comment, :return_to => 'rejected'),
- :class => 'comment_cross_icon' unless @comment.rejected? %>
+ <%= link_to t('.reject'), refinery.reject_blog_admin_comment_path(@comment),
+ :method => :post,
+ :class => 'comment_cross_icon' unless @comment.rejected? %>
</li>
<li>
- <%= link_to t('.approve'), refinery.approved_blog_admin_comment_path(@comment, :return_to => 'approved'),
- :class => 'comment_tick_icon' unless @comment.approved? %>
+ <%= link_to t('.approve'), refinery.approve_blog_admin_comment_path(@comment),
+ :method => :post,
+ :class => 'comment_tick_icon' unless @comment.approved? %>
</li>
</ul>
</div>