BUGFIX Monitoring form for locale changes in CMSMain.Translatable.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92662 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:38:44 +00:00
parent b9041367bf
commit 371abfdd1d

View File

@ -8,12 +8,20 @@
return/** @lends ss.CMSMain.LangSelector */{ return/** @lends ss.CMSMain.LangSelector */{
onmatch: function() { onmatch: function() {
var self = this; var self = this;
// monitor form loading for any locale changes
$('#Form_EditForm').bind('loadnewpage', function(e) {
var newLocale = $(this).find(':input[name=Locale]').val();
if(newLocale) self.val(newLocale);
});
// whenever a new value is selected, reload the whole CMS in the new locale
this.bind('change', function(e) { this.bind('change', function(e) {
document.location = 'admin/?locale=' + $(e.target).val(); document.location = 'admin/?locale=' + $(e.target).val();
return false; return false;
}); });
} }
} };
}); });
/** /**
@ -44,7 +52,7 @@
return false; return false;
}); });
} }
} };
}); });
}(jQuery)); }(jQuery));