Skip to content

Commit 371abfd

Browse files
committed
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
1 parent b904136 commit 371abfd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

javascript/CMSMain.Translatable.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@
88
return/** @lends ss.CMSMain.LangSelector */{
99
onmatch: function() {
1010
var self = this;
11+
12+
// monitor form loading for any locale changes
13+
$('#Form_EditForm').bind('loadnewpage', function(e) {
14+
var newLocale = $(this).find(':input[name=Locale]').val();
15+
if(newLocale) self.val(newLocale);
16+
});
17+
18+
// whenever a new value is selected, reload the whole CMS in the new locale
1119
this.bind('change', function(e) {
1220
document.location = 'admin/?locale=' + $(e.target).val();
1321
return false;
1422
});
1523
}
16-
}
24+
};
1725
});
1826

1927
/**
@@ -44,7 +52,7 @@
4452
return false;
4553
});
4654
}
47-
}
55+
};
4856
});
4957

5058
}(jQuery));

0 commit comments

Comments
 (0)