summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-09-23 15:20:19 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-09-23 15:20:19 +0000
commit401197a895680f824f9aec9d82b25ae686e6b206 (patch)
tree13999265177f4b06ab44472c9e2dec9783debf3a /app
parent4948121af054ff5e38854a52b29c5c48b0c4f3fa (diff)
downloadredmine-401197a895680f824f9aec9d82b25ae686e6b206.tar.gz
redmine-401197a895680f824f9aec9d82b25ae686e6b206.zip
Refactor: move #destroy_comment method to CommentsController#destroy
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4172 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/comments_controller.rb6
-rw-r--r--app/controllers/news_controller.rb5
-rw-r--r--app/views/news/show.rhtml4
3 files changed, 8 insertions, 7 deletions
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index c0d524a25..7432f831f 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -16,6 +16,12 @@ class CommentsController < ApplicationController
redirect_to :controller => 'news', :action => 'show', :id => @news
end
+ verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
+ def destroy
+ @news.comments.find(params[:comment_id]).destroy
+ redirect_to :controller => 'news', :action => 'show', :id => @news
+ end
+
private
# ApplicationController's find_model_object sets it based on the controller
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index d15ae3291..47f467862 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -73,11 +73,6 @@ class NewsController < ApplicationController
end
end
- def destroy_comment
- @news.comments.find(params[:comment_id]).destroy
- redirect_to :action => 'show', :id => @news
- end
-
def destroy
@news.destroy
redirect_to :action => 'index', :project_id => @project
diff --git a/app/views/news/show.rhtml b/app/views/news/show.rhtml
index 9b8f2510e..7861a3d01 100644
--- a/app/views/news/show.rhtml
+++ b/app/views/news/show.rhtml
@@ -39,8 +39,8 @@
<% @comments.each do |comment| %>
<% next if comment.new_record? %>
<div class="contextual">
- <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'news', :action => 'destroy_comment', :id => @news, :comment_id => comment},
- :confirm => l(:text_are_you_sure), :method => :post, :title => l(:button_delete) %>
+ <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
+ :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %>
</div>
<h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
<%= textilizable(comment.comments) %>