summaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-02-21 09:53:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-02-21 09:53:29 +0000
commit17591a3ea58a6da8d619bdd9dd0ece4b73a07402 (patch)
tree1ca2cd6fc86457ea58caf4e1adca21679bd4fafc /app/helpers/application_helper.rb
parent11c72f2823f19172a480a6636fc32495de8e018a (diff)
downloadredmine-17591a3ea58a6da8d619bdd9dd0ece4b73a07402.tar.gz
redmine-17591a3ea58a6da8d619bdd9dd0ece4b73a07402.zip
Warning on leaving a page with unsaved content in textarea (#2910).
The warning can be turned off in the user's preference. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4900 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c6d88487f..be0ebaec1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -894,6 +894,15 @@ module ApplicationHelper
''
end
end
+
+ # Returns the javascript tags that are included in the html layout head
+ def javascript_heads
+ tags = javascript_include_tag(:defaults)
+ unless User.current.pref.warn_on_leaving_unsaved == '0'
+ tags << "\n" + javascript_tag("Event.observe(window, 'load', function(){ new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}'); });")
+ end
+ tags
+ end
def favicon
"<link rel='shortcut icon' href='#{image_path('/favicon.ico')}' />"