mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
elofgren: USABILITY: Use a confirm() javascript dialog box instead of the slow loading modal one for asking user if they want to save their changes when they click on a new page in the left tree. 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@41796 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9792c6bf37
commit
067d630e06
@ -382,31 +382,19 @@ function autoSave(confirmation, callAfter) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if(__somethingHasChanged) {
|
if(__somethingHasChanged) {
|
||||||
var options = {
|
if(confirmation ) {
|
||||||
save: function() {
|
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."))
|
||||||
statusMessage('saving...', '', true);
|
{
|
||||||
var i;
|
// OK was pressed, call function for what was clicked on
|
||||||
for(i=0;i<__forms.length;i++) {
|
|
||||||
if(__forms[i].isChanged && __forms[i].isChanged()) {
|
|
||||||
if(i == 0) __forms[i].save(true, __callAfter);
|
|
||||||
else __forms[i].save(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
discard: function() {
|
|
||||||
__forms.each(function(form) { form.resetElements(false); });
|
|
||||||
if(__callAfter) __callAfter();
|
if(__callAfter) __callAfter();
|
||||||
},
|
} else {
|
||||||
cancel: function() {
|
// Cancel was pressed, stay on the current page their stuff
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
options.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fix the modal dialog!
|
|
||||||
*/
|
|
||||||
if(confirmation ) doYouWantToSave(options);
|
|
||||||
else options.save();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(__callAfter) __callAfter();
|
if(__callAfter) __callAfter();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user