mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-04-16 11:11:02 +00:00
Moved update tab functionality to MainSwitch.
This commit is contained in:
parent
28f1a5eff2
commit
9e09bdccbc
1 changed files with 13 additions and 15 deletions
|
|
@ -186,13 +186,10 @@ var google, django, gettext;
|
|||
$fields: $(this).parent().prev().prev().find('.mt')
|
||||
});
|
||||
var tabs = createTabs(grouper.groupedTranslations);
|
||||
|
||||
// Update the main switch as it is not aware of the newly created tabs
|
||||
MainSwitch.update(tabs);
|
||||
// Activate the language tab selected in the main switch
|
||||
$.each(tabs, function (idx, tab) {
|
||||
tab.tabs('select', parseInt(MainSwitch.$select.val()));
|
||||
});
|
||||
MainSwitch.activateTab(tabs);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -278,15 +275,13 @@ var google, django, gettext;
|
|||
|
||||
function handleTabularAddAnotherInline(tabularInlineGroup) {
|
||||
tabularInlineGroup.$table.find('.add-row a').click(function () {
|
||||
var tabs = createTabularTabs(tabularInlineGroup.getGroupedTranslations(
|
||||
$(this).parent().parent().prev().prev().find('.mt')));
|
||||
var tabs = createTabularTabs(
|
||||
tabularInlineGroup.getGroupedTranslations(
|
||||
$(this).parent().parent().prev().prev().find('.mt')));
|
||||
// Update the main switch as it is not aware of the newly created tabs
|
||||
MainSwitch.update(tabs);
|
||||
// Activate the language tab selected in the main switch
|
||||
$.each(tabs, function (i, tab) {
|
||||
tab.tabs('select', parseInt(MainSwitch.$select.val()));
|
||||
});
|
||||
|
||||
MainSwitch.activateTab(tabs);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -354,11 +349,7 @@ var google, django, gettext;
|
|||
self.$select.append($('<option value="' + idx + '">' +
|
||||
language.replace('_', '-') + '</option>'));
|
||||
});
|
||||
this.$select.change(function () {
|
||||
$.each(tabs, function (idx, tab) {
|
||||
tab.tabs('select', parseInt(self.$select.val()));
|
||||
});
|
||||
});
|
||||
this.update(tabs);
|
||||
$('#content').find('h1').append(' ').append(self.$select);
|
||||
},
|
||||
|
||||
|
|
@ -369,6 +360,13 @@ var google, django, gettext;
|
|||
tab.tabs('select', parseInt(self.$select.val()));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
activateTab: function(tabs) {
|
||||
var self = this;
|
||||
$.each(tabs, function (idx, tab) {
|
||||
tab.tabs('select', parseInt(self.$select.val()));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue