blob: d01340e6d3c34803a22849a8fd96c37c825b9b49 (
plain)
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
|
define([
'./base-facet',
'../templates'
], function (BaseFacet) {
var $ = jQuery;
return BaseFacet.extend({
template: Templates['issues-file-facet'],
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
var maxValueWidth = _.max(this.$('.facet-stat').map(function () {
return $(this).outerWidth();
}).get());
return this.$('.facet-name').css('padding-right', maxValueWidth);
},
getValuesWithLabels: function () {
var values = this.model.getValues(),
source = this.options.app.facets.components;
values.forEach(function (v) {
var key = v.val,
label = null;
if (key) {
var item = _.findWhere(source, { uuid: key });
if (item != null) {
label = item.longName;
}
}
v.label = label;
});
return values;
},
serializeData: function () {
return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), {
values: this.sortValues(this.getValuesWithLabels())
});
}
});
});
|