mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
elofgren: USABILITY: Make Newsletter section use new js confirm dialog instead of old modal one. 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@41799 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f7ed6b050f
commit
93ae866e60
@ -488,6 +488,8 @@ function autoSave(confirmation, callAfter) {
|
||||
});
|
||||
|
||||
if(__somethingHasChanged) {
|
||||
// Note: discard and cancel options are no longer used since switching to confirm dialog.
|
||||
// save is still used if confirmation = false
|
||||
var options = {
|
||||
save: function() {
|
||||
statusMessage('saving...', '', true);
|
||||
@ -507,8 +509,18 @@ function autoSave(confirmation, callAfter) {
|
||||
}
|
||||
}
|
||||
|
||||
if(confirmation) doYouWantToSave(options);
|
||||
else options.save();
|
||||
if(confirmation ) {
|
||||
if(confirm("Are you sure you want to navigate away from this page?\n\nWARNING: Your changes have not been saved.\n\nPress OK to continue, or Cancel to stay on the current page."))
|
||||
{
|
||||
// OK was pressed, call function for what was clicked on
|
||||
if(__callAfter) __callAfter();
|
||||
} else {
|
||||
// Cancel was pressed, stay on the current page
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
options.save();
|
||||
}
|
||||
|
||||
} else {
|
||||
if(__callAfter) __callAfter();
|
||||
|
Loading…
Reference in New Issue
Block a user