Files
doitinpoland.com/wp-content/plugins/sitepress-multilingual-cms/res/js/taxonomy-translation/views/table-view.js
2023-09-12 21:41:04 +02:00

49 lines
1.1 KiB
JavaScript

/*globals labels */
(function () {
TaxonomyTranslation.views.TableView = Backbone.View.extend({
template: WPML_core[ 'templates/taxonomy-translation/table.html' ],
tag: 'div',
termsView: {},
model: TaxonomyTranslation.models.Taxonomy,
initialize: function ( data, options ) {
this.type = options.type;
},
render: function () {
if ( ! TaxonomyTranslation.classes.taxonomy.get( "taxonomy" ) ) {
return false;
}
var self = this,
langs = TaxonomyTranslation.data.activeLanguages,
count = self.isTermTable() ? TaxonomyTranslation.data.termRowsCollection.length : 1,
tax = self.model.get( 'taxonomy' ),
firstColumnHeading = self.isTermTable() ? labels.firstColumnHeading.replace( '%taxonomy%', TaxonomyTranslation.data.taxonomies[ tax ].singularLabel ) : '';
this.$el.html(self.template({
langs: langs,
tableType: self.type,
count: count,
firstColumnHeading: firstColumnHeading,
mode: TaxonomyTranslation.mainView.mode
}));
return self;
},
isTermTable: function () {
return this.type === 'terms';
},
clear: function () {
}
});
})(TaxonomyTranslation);