Refactor: Moved ApplicationController#attach_files to the Attachment model

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3523 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2010-03-02 19:26:03 +00:00
parent 81d617cd5b
commit 0fd7e2d696
7 changed files with 54 additions and 37 deletions

View File

@@ -303,9 +303,11 @@ class ProjectsController < ApplicationController
def add_file
if request.post?
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
attachments = attach_files(container, params[:attachments])
attachments = Attachment.attach_files(container, params[:attachments])
flash[:warning] = attachments[:flash] if attachments[:flash]
if !attachments.empty? && Setting.notified_events.include?('file_added')
Mailer.deliver_attachments_added(attachments)
Mailer.deliver_attachments_added(attachments[:files])
end
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
return