summaryrefslogtreecommitdiffstats
path: root/app/controllers/news_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/news_controller.rb')
-rw-r--r--app/controllers/news_controller.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index b50b59dc0..544b6eb8d 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -27,7 +27,23 @@ class NewsController < ApplicationController
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @news
end
+ end
+
+ def add_comment
+ @comment = Comment.new(params[:comment])
+ @comment.author = logged_in_user
+ if @news.comments << @comment
+ flash[:notice] = l(:label_comment_added)
+ redirect_to :action => 'show', :id => @news
+ else
+ render :action => 'show'
+ end
end
+
+ def destroy_comment
+ @news.comments.find(params[:comment_id]).destroy
+ redirect_to :action => 'show', :id => @news
+ end
def destroy
@news.destroy