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
|
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import './templates';
export default Marionette.ItemView.extend({
tagName: 'a',
className: 'list-group-item',
template: Templates['quality-profiles-profile'],
modelEvents: {
'change': 'render'
},
events: {
'click': 'onClick'
},
onRender: function () {
this.$el.toggleClass('active', this.options.highlighted);
this.$el.attr('data-key', this.model.id);
this.$el.attr('data-language', this.model.get('language'));
this.$('[data-toggle="tooltip"]').tooltip({ container: 'body' });
},
onDestroy: function () {
this.$('[data-toggle="tooltip"]').tooltip('destroy');
},
onClick: function (e) {
e.preventDefault();
this.model.trigger('select', this.model);
},
serializeData: function () {
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
projectCountFormatted: window.formatMeasure(this.model.get('projectCount'), 'INT')
});
}
});
|