summaryrefslogtreecommitdiffstats
path: root/app/controllers/files_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-09 10:29:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-09 10:29:21 +0000
commitfd034f734183a650aa40eacc0285d6737a26190c (patch)
tree4b3c697bc5660f303c5f56a124853b34390e7ce7 /app/controllers/files_controller.rb
parent27bcd879f31450bf32397864b4d36d2bacc8ee6d (diff)
downloadredmine-fd034f734183a650aa40eacc0285d6737a26190c.tar.gz
redmine-fd034f734183a650aa40eacc0285d6737a26190c.zip
Adds flash messages to files_controller#create (#19793).
git-svn-id: http://svn.redmine.org/redmine/trunk@14243 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/files_controller.rb')
-rw-r--r--app/controllers/files_controller.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 253d73bfa..73409c765 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -47,9 +47,16 @@ class FilesController < ApplicationController
attachments = Attachment.attach_files(container, params[:attachments])
render_attachment_warning_if_needed(container)
- if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
- Mailer.attachments_added(attachments[:files]).deliver
+ if attachments[:files].present?
+ if Setting.notified_events.include?('file_added')
+ Mailer.attachments_added(attachments[:files]).deliver
+ end
+ flash[:notice] = l(:label_file_added)
+ redirect_to project_files_path(@project)
+ else
+ flash.now[:error] = l(:label_attachment) + " " + l('activerecord.errors.messages.invalid')
+ new
+ render :action => 'new'
end
- redirect_to project_files_path(@project)
end
end