table-view.js
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*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);