diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-13 20:35:03 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-13 20:35:03 +0000 |
commit | 41c055363ee4826799b9ffe7d76fd399c89190d3 (patch) | |
tree | 78321389f47072812eeb42dc6d5759f8c15addbb /app/controllers/files_controller.rb | |
parent | 12e10f6956fcd276fc3da19beb0c7bf4ade5f0da (diff) | |
download | redmine-41c055363ee4826799b9ffe7d76fd399c89190d3.tar.gz redmine-41c055363ee4826799b9ffe7d76fd399c89190d3.zip |
Refactor: split FilesController#new into #new and #create.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4084 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/files_controller.rb')
-rw-r--r-- | app/controllers/files_controller.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index fe5eb48c8..0a4903d08 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -19,19 +19,18 @@ class FilesController < ApplicationController render :layout => !request.xhr? end - # TODO: split method into new (GET) and create (POST) def new - if request.post? - container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) - attachments = Attachment.attach_files(container, params[:attachments]) - render_attachment_warning_if_needed(container) + @versions = @project.versions.sort + end - if !attachments.empty? && Setting.notified_events.include?('file_added') - Mailer.deliver_attachments_added(attachments[:files]) - end - redirect_to :controller => 'files', :action => 'index', :id => @project - return + def create + container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) + attachments = Attachment.attach_files(container, params[:attachments]) + render_attachment_warning_if_needed(container) + + if !attachments.empty? && Setting.notified_events.include?('file_added') + Mailer.deliver_attachments_added(attachments[:files]) end - @versions = @project.versions.sort + redirect_to :controller => 'files', :action => 'index', :id => @project end end |