From 371abfdd1d4bc459b70b9eee8e9189929ccf8dd2 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 02:38:44 +0000 Subject: [PATCH] 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 --- javascript/CMSMain.Translatable.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/javascript/CMSMain.Translatable.js b/javascript/CMSMain.Translatable.js index f34ee833..72d60c68 100755 --- a/javascript/CMSMain.Translatable.js +++ b/javascript/CMSMain.Translatable.js @@ -8,12 +8,20 @@ return/** @lends ss.CMSMain.LangSelector */{ onmatch: function() { 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) { document.location = 'admin/?locale=' + $(e.target).val(); return false; }); } - } + }; }); /** @@ -44,7 +52,7 @@ return false; }); } - } + }; }); }(jQuery)); \ No newline at end of file