');
tabsList.append(tab);
tabsContainer.append(panel);
});
@@ -174,10 +188,10 @@ var google, django, gettext;
var tabs = createTabs(grouper.groupedTranslations);
// Update the main switch as it is not aware of the newly created tabs
- var $select = updateMainSwitch(tabs);
+ MainSwitch.update(tabs);
// Activate the language tab selected in the main switch
$.each(tabs, function (idx, tab) {
- tab.tabs('select', parseInt($select.val()));
+ tab.tabs('select', parseInt(MainSwitch.$select.val()));
});
});
}
@@ -197,7 +211,8 @@ var google, django, gettext;
this.getAllGroupedTranslations = function () {
var grouper = new TranslationFieldGrouper({
- $fields: this.$table.find('.mt').filter('input[type=text]:visible, textarea:visible')
+ $fields: this.$table.find('.mt').filter(
+ 'input[type=text]:visible, textarea:visible')
});
this.translationColumns = this.getTranslationColumns(grouper.groupedTranslations);
//this.requiredColumns = this.getRequiredColumns();
@@ -266,10 +281,10 @@ var google, django, gettext;
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
- var $select = updateMainSwitch(tabs);
+ MainSwitch.update(tabs);
// Activate the language tab selected in the main switch
$.each(tabs, function (i, tab) {
- tab.tabs('select', parseInt($select.val()));
+ tab.tabs('select', parseInt(MainSwitch.$select.val()));
});
});
@@ -285,33 +300,35 @@ var google, django, gettext;
tabsContainer.append(tabsList);
$.each(lang, function (lang, el) {
- var container = $(el).parent(),
- tabId = 'tab_' + $(el).attr('id'),
- panel,
- tab;
+ var $container = $(el).parent(),
+ $panel,
+ $tab,
+ tabId = 'tab_' + $(el).attr('id');
if (!insertionPoint) {
insertionPoint = {
- 'insert': container.prev().length ? 'after' : container.next().length ? 'prepend' : 'append',
- 'el': container.prev().length ? container.prev() : container.parent()
+ 'insert': $container.prev().length ? 'after' :
+ $container.next().length ? 'prepend' : 'append',
+ 'el': $container.prev().length ? $container.prev() : $container.parent()
};
}
- panel = $('').append(container);
+ $panel = $('').append($container);
// Turn the moved tds into divs
var attrs = {};
- $.each($(container)[0].attributes, function(idx, attr) {
+ $.each($container[0].attributes, function(idx, attr) {
attrs[attr.nodeName] = attr.nodeValue;
});
- $(container).replaceWith(function () {
+ $container.replaceWith(function () {
return $('', attrs).append($(this).contents());
});
- // TODO: Setting the required state based on the default field is to naive.
+ // TODO: Setting the required state based on the default field is naive.
// The user might have tweaked his admin. We somehow have to keep track of the
// column indexes _before_ the tds have been moved around.
- tab = $('