diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-03 14:44:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-03 14:44:12 +0000 |
commit | e0bda97b6f9379782f246a15365eba713eb75d53 (patch) | |
tree | c21a872bec43ba6d2a8cd113fdc2e932d6e4d1df /app | |
parent | d25b6d46863a2c8ff2a18b08b8674d0a0adc0aec (diff) | |
download | redmine-e0bda97b6f9379782f246a15365eba713eb75d53.tar.gz redmine-e0bda97b6f9379782f246a15365eba713eb75d53.zip |
Display a warning if some attachments were not saved (#2008).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2224 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 7d89e2163..e8d0a85b7 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -175,6 +175,7 @@ class ApplicationController < ActionController::Base # TODO: move to model def attach_files(obj, attachments) attached = [] + unsaved = [] if attachments && attachments.is_a?(Hash) attachments.each_value do |attachment| file = attachment['file'] @@ -183,7 +184,10 @@ class ApplicationController < ActionController::Base :file => file, :description => attachment['description'].to_s.strip, :author => User.current) - attached << a unless a.new_record? + a.new_record? ? (unsaved << a) : (attached << a) + end + if unsaved.any? + flash[:warning] = l(:warning_attachments_not_saved, unsaved.size) end end attached |