diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-03 17:05:00 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-03 17:05:00 +0000 |
commit | fe1e3ccd18420752979d817fac4408c780ba1da2 (patch) | |
tree | d7c9bbda24e92c5180c8c8f4adeb03c77c3493d8 /app/controllers/documents_controller.rb | |
parent | 44955a519c77abe09e9706135a0443761604c780 (diff) | |
download | redmine-fe1e3ccd18420752979d817fac4408c780ba1da2.tar.gz redmine-fe1e3ccd18420752979d817fac4408c780ba1da2.zip |
Refactor: Decouple failed attachments and the flash messages
Attachment#attach_files will no longer need to return a flash message,
instead it will put unsaved attachments into object#unsaved_attachments
where the calling object can access them.
A utility method #render_attachment_warning_if_needed is included for setting
the standard flash warning.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3528 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/documents_controller.rb')
-rw-r--r-- | app/controllers/documents_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 135ae2198..526bf8123 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -48,7 +48,7 @@ class DocumentsController < ApplicationController @document = @project.documents.build(params[:document]) if request.post? and @document.save attachments = Attachment.attach_files(@document, params[:attachments]) - flash[:warning] = attachments[:flash] if attachments[:flash] + render_attachment_warning_if_needed(@document) flash[:notice] = l(:notice_successful_create) redirect_to :action => 'index', :project_id => @project end @@ -69,7 +69,7 @@ class DocumentsController < ApplicationController def add_attachment attachments = Attachment.attach_files(@document, params[:attachments]) - flash[:warning] = attachments[:flash] if attachments[:flash] + render_attachment_warning_if_needed(@document) Mailer.deliver_attachments_added(attachments[:files]) if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added') redirect_to :action => 'show', :id => @document |