mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
elofgren: Add back options save code deleted in r36865 because it is used if confirmation=false
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41797 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
067d630e06
commit
b1173b174b
@ -382,13 +382,34 @@ 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);
|
||||
var i;
|
||||
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();
|
||||
},
|
||||
cancel: function() {
|
||||
}
|
||||
}
|
||||
|
||||
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 their stuff
|
||||
// Cancel was pressed, stay on the current page
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user