Permalink
Browse files

BUGFIX Fixed duplicated 'confirm save' message in changetracker logic…

… for LeftAndMain.EditForm.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92697 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
chillu committed Nov 21, 2009
1 parent 8b8867b commit ffb6790fe646ff318c9328dd1b9623bc5b977602
Showing with 10 additions and 8 deletions.
  1. +8 −7 javascript/LeftAndMain.EditForm.js
  2. +2 −1 javascript/lang/en_US.js
@@ -53,25 +53,26 @@
* Checks the jquery.changetracker plugin status for this form.
* Usually bound to window.onbeforeunload.
*
- * @param {boolean} doConfirm
+ * @param {boolean} isUnloadEvent
* @return Either a string with a confirmation message, or the result of a confirm() dialog,
- * based on the doConfirm parameter.
+ * based on the isUnloadEvent parameter.
*/
- _checkChangeTracker: function(doConfirm) {
+ _checkChangeTracker: function(isUnloadEvent) {
var self = this;
// @todo TinyMCE coupling
if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
// check for form changes
if(self.is('.changed')) {
- var msg = ss.i18n._t('LeftAndMain.CONFIRMUNSAVED');
// returned string will trigger a confirm() dialog,
// but only if the method is triggered by an event
- return (doConfirm) ? confirm(msg) : msg;
+ if(isUnloadEvent) {
+ return confirm(ss.i18n._t('LeftAndMain.CONFIRMUNSAVED'));
+ } else {
+ return ss.i18n._t('LeftAndMain.CONFIRMUNSAVEDSHORT');
+ }
}
-
- return null;
},
/**
View
@@ -24,6 +24,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
'ModelAdmin.DELETED': "Deleted",
'ModelAdmin.VALIDATIONERROR': "Validation Error",
'LeftAndMain.PAGEWASDELETED': "This page was deleted. To edit a page, select it from the left.",
- 'LeftAndMain.CONFIRMUNSAVED': "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."
+ 'LeftAndMain.CONFIRMUNSAVED': "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.",
+ 'LeftAndMain.CONFIRMUNSAVEDSHORT': "WARNING: Your changes have not been saved."
});
}

0 comments on commit ffb6790

Please sign in to comment.