mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
elofgren: USABILITY: 1. Always use confirmation when calling autoSave, not just for 'Microsoft Internet Explorer' since the new confirm() dialog works in all browsers.
2. Make MainMenu? links call LeftAndMain?_window_unload() to check for unsaved changes before loading new page. Don't register LeftAndMain?_window_unload with window 'beforeunload' event because it cannot stop the page unload and the save check is now done via links (where stopping the unload works). 3. Make external Logo link open in a new window like the Menu-help link to prevent unsaved changes being lost. More info: http://www.elijahlofgren.com/silverstripe/alert-users-when-leaving-tab-with-unsaved-changes/ (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41798 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b1173b174b
commit
f7ed6b050f
@ -79,6 +79,7 @@ Behaviour.register({
|
|||||||
|
|
||||||
'#MainMenu li' : {
|
'#MainMenu li' : {
|
||||||
onclick : function(event) {
|
onclick : function(event) {
|
||||||
|
return LeftAndMain_window_unload(); // Confirm if there are unsaved changes
|
||||||
window.location.href = this.getElementsByTagName('a')[0].href;
|
window.location.href = this.getElementsByTagName('a')[0].href;
|
||||||
Event.stop(event);
|
Event.stop(event);
|
||||||
}
|
}
|
||||||
@ -90,6 +91,14 @@ Behaviour.register({
|
|||||||
w.focus();
|
w.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'#Logo' : {
|
||||||
|
onclick : function() {
|
||||||
|
var w = window.open(this.getElementsByTagName('a')[0].href);
|
||||||
|
w.focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -166,11 +175,12 @@ function isVisible(el) {
|
|||||||
|
|
||||||
LeftAndMain_window_unload = function() {
|
LeftAndMain_window_unload = function() {
|
||||||
window.exiting = true; // this is used by prototype
|
window.exiting = true; // this is used by prototype
|
||||||
if(typeof autoSave == 'function')
|
if(typeof autoSave == 'function') {
|
||||||
autoSave(navigator.appName == "Microsoft Internet Explorer");
|
return autoSave(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Event.observe(window, 'beforeunload', LeftAndMain_window_unload);
|
// Event.observe(window, 'beforeunload', LeftAndMain_window_unload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlock the locked status message.
|
* Unlock the locked status message.
|
||||||
|
@ -410,7 +410,7 @@ function autoSave(confirmation, callAfter) {
|
|||||||
if(__callAfter) __callAfter();
|
if(__callAfter) __callAfter();
|
||||||
} else {
|
} else {
|
||||||
// Cancel was pressed, stay on the current page
|
// Cancel was pressed, stay on the current page
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
options.save();
|
options.save();
|
||||||
|
Loading…
Reference in New Issue
Block a user