summaryrefslogtreecommitdiffstats
path: root/app/controllers/news_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-10 18:35:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-10 18:35:48 +0000
commit55ed70529aefdb3029f5ab72169b2f7909b2f2a3 (patch)
tree1f1dbf48685483905949c121cafe36e26c7efc7c /app/controllers/news_controller.rb
parent28c6aa4e6dfe7b4261cd4b4feb50eda62ace0572 (diff)
downloadredmine-55ed70529aefdb3029f5ab72169b2f7909b2f2a3.tar.gz
redmine-55ed70529aefdb3029f5ab72169b2f7909b2f2a3.zip
added model Comment.
comments can now be added on news. git-svn-id: http://redmine.rubyforge.org/svn/trunk@81 e93f8b46-1217-0410-a6f0-8f06a7374b81
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