mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-28 22:08:18 +00:00
Avoid computing "grouped_translations" twice (for tabs and the main switch) in the tabbed translation admin script (the second computation was missing some languages under certain circumstances).
This commit is contained in:
parent
1d82f61da8
commit
79165ed942
1 changed files with 5 additions and 6 deletions
|
|
@ -55,8 +55,7 @@ var google, django, gettext;
|
|||
return grouped_translations;
|
||||
}
|
||||
|
||||
function createTabs() {
|
||||
var grouped_translations = getGroupedTranslationFields();
|
||||
function createTabs(grouped_translations) {
|
||||
var tabs = [];
|
||||
$.each(grouped_translations, function (name, languages) {
|
||||
var tabs_container = $('<div></div>'),
|
||||
|
|
@ -93,9 +92,8 @@ var google, django, gettext;
|
|||
return tabs;
|
||||
}
|
||||
|
||||
function createMainSwitch(tabs) {
|
||||
var grouped_translations = getGroupedTranslationFields(),
|
||||
unique_languages = [],
|
||||
function createMainSwitch(grouped_translations, tabs) {
|
||||
var unique_languages = [],
|
||||
select = $('<select>');
|
||||
$.each(grouped_translations, function (name, languages) {
|
||||
$.each(languages, function (lang, el) {
|
||||
|
|
@ -116,7 +114,8 @@ var google, django, gettext;
|
|||
}
|
||||
|
||||
if ($('body').hasClass('change-form')) {
|
||||
createMainSwitch(createTabs());
|
||||
var grouped_translations = getGroupedTranslationFields();
|
||||
createMainSwitch(grouped_translations, createTabs(grouped_translations));
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
|
|
|||
Loading…
Reference in a new issue