ENHANCEMENT Better feedback for validation errors in ModelAdmin

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@73031 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-03-13 10:19:57 +00:00
parent 644c7e06c6
commit 9260326ee6
2 changed files with 7 additions and 2 deletions

View File

@ -58,7 +58,7 @@ $(document).ready(function() {
$('#statusMessage').css('top', newTopValue);
}
}
//////////////////////////////////////////////////////////////////
// Search form
//////////////////////////////////////////////////////////////////
@ -202,7 +202,11 @@ $(document).ready(function() {
$.post(formAction, form.formToArray(), function(result){
$('#right #ModelAdminPanel').html(result);
statusMessage(ss.i18n._t('ModelAdmin.SAVED', 'Saved'));
if($('#right #ModelAdminPanel form').hasClass('validationerror')) {
statusMessage(ss.i18n._t('ModelAdmin.VALIDATIONERROR', 'Validation Error'), 'bad');
} else {
statusMessage(ss.i18n._t('ModelAdmin.SAVED', 'Saved'), 'good');
}
// TODO/SAM: It seems a bit of a hack to have to list all the little updaters here.
// Is livequery a solution?

View File

@ -22,6 +22,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
'ModelAdmin.SAVED': "Saved",
'ModelAdmin.REALLYDELETE': "Do you really want to delete?",
'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."
});