diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0ca9345f5b..022933ac47 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -993,7 +993,12 @@ module ApplicationHelper I18n.locale = "#{I18n.locale}"; }) unless User.current.pref.warn_on_leaving_unsaved == '0' - tags += javascript_tag("jQuery(function(){ new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}'); });") + tags += javascript_tag("jQuery(document).ready(function(){ + new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}'); + jQuery(document).ajaxComplete(function(){ + new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}') + }); + })") end if User.current.impaired? and accessibility_js_enabled? diff --git a/features/work_packages/attachments.feature b/features/work_packages/attachments.feature index 75ffdbfca0..59d9f7acad 100644 --- a/features/work_packages/attachments.feature +++ b/features/work_packages/attachments.feature @@ -43,6 +43,8 @@ Feature: Attachments on work packages | edit_work_packages | And there is 1 user with the following: | login | bob| + And the user "bob" has the following preferences + | warn_on_leaving_unsaved | 0 | And the user "bob" is a "member" in the project "parent" And there are the following issue status: | name | is_closed | is_default |