summaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index c2fd2c2f5..58d87e7ed 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -301,4 +301,9 @@ class ApplicationController < ActionController::Base
def api_request?
%w(xml json).include? params[:format]
end
+
+ # Renders a warning flash if obj has unsaved attachments
+ def render_attachment_warning_if_needed(obj)
+ flash[:warning] = l(:warning_attachments_not_saved, obj.unsaved_attachments.size) if obj.unsaved_attachments.present?
+ end
end