summaryrefslogtreecommitdiffstats
path: root/app/controllers/news_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-29 22:39:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-29 22:39:06 +0000
commit24138187eb130b15d5b2b9f7bd6f701b2be6c00a (patch)
tree472ca1d96d538420fc537b743c5ac3b925723044 /app/controllers/news_controller.rb
parent992aebf6dfe9ca92d43e1022102f5c888631a6f4 (diff)
downloadredmine-24138187eb130b15d5b2b9f7bd6f701b2be6c00a.tar.gz
redmine-24138187eb130b15d5b2b9f7bd6f701b2be6c00a.zip
Allows attachments on news (#1972).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8728 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/news_controller.rb')
-rw-r--r--app/controllers/news_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 0d091396a..34d4a13cc 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -27,6 +27,7 @@ class NewsController < ApplicationController
accept_api_auth :index
helper :watchers
+ helper :attachments
def index
case params[:format]
@@ -70,6 +71,8 @@ class NewsController < ApplicationController
if request.post?
@news.attributes = params[:news]
if @news.save
+ attachments = Attachment.attach_files(@news, params[:attachments])
+ render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'news', :action => 'index', :project_id => @project
else
@@ -83,6 +86,8 @@ class NewsController < ApplicationController
def update
if request.put? and @news.update_attributes(params[:news])
+ attachments = Attachment.attach_files(@news, params[:attachments])
+ render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @news
else