mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Moved window.beforeunload handler out of onmatch(), was applied multiple times and causing unsaved changes confirmation messages on forms which were no longer loaded
This commit is contained in:
parent
c69e949bc9
commit
e8f9624b42
@ -2,6 +2,14 @@
|
|||||||
* File: LeftAndMain.EditForm.js
|
* File: LeftAndMain.EditForm.js
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
|
// Can't bind this through jQuery
|
||||||
|
window.onbeforeunload = function(e) {
|
||||||
|
var form = $('.cms-edit-form');
|
||||||
|
form.trigger('beforesave');
|
||||||
|
if(form.is('.changed')) return ss.i18n._t('LeftAndMain.CONFIRMUNSAVEDSHORT');
|
||||||
|
};
|
||||||
|
|
||||||
$.entwine('ss', function($){
|
$.entwine('ss', function($){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,12 +60,6 @@
|
|||||||
|
|
||||||
this._setupChangeTracker();
|
this._setupChangeTracker();
|
||||||
|
|
||||||
// Can't bind this through jQuery
|
|
||||||
window.onbeforeunload = function(e) {
|
|
||||||
self.trigger('beforesave');
|
|
||||||
if(self.is('.changed')) return ss.i18n._t('LeftAndMain.CONFIRMUNSAVEDSHORT');
|
|
||||||
};
|
|
||||||
|
|
||||||
// Catch navigation events before they reach handleStateChange(),
|
// Catch navigation events before they reach handleStateChange(),
|
||||||
// in order to avoid changing the menu state if the action is cancelled by the user
|
// in order to avoid changing the menu state if the action is cancelled by the user
|
||||||
// $('.cms-menu')
|
// $('.cms-menu')
|
||||||
|
Loading…
Reference in New Issue
Block a user