-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.js
More file actions
63 lines (53 loc) · 1.17 KB
/
Copy pathlist.js
File metadata and controls
63 lines (53 loc) · 1.17 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Trello Card List
*/
function list(el)
{
this.totalQty = 0;
this.totalEstimated = 0;
var $total=$('<span class="list-total">'),
$el = $(el);
this.calculate = function()
{
var totalQty = 0;
var totalEstimated = 0;
$el.find('.list-card').each(function(){
if (this.card)
{
totalQty += this.card.qty;
totalEstimated += this.card.estimated;
}
});
this.totalQty = totalQty;
this.totalEstimated = totalEstimated;
show(this);
//calculate board total
calculateBoardTotal();
};
this.setTotals = function(totalQty, totalEstimated)
{
this.totalQty = totalQty;
this.totalEstimated = totalEstimated;
show(this);
};
/**
* DOM change - add list heder total qty and total estimated
* */
var show = function(list)
{
$total.empty().appendTo($el.find('.list-header'));
var text = '';
var level = 'normal';
if (list.totalQty > 0 || list.totalEstimated > 0)
{
text += list.totalQty;
if (list.totalEstimated > 0)
{
if (list.totalEstimated < list.totalQty)
level = 'overhead';
text += ' / ' + list.totalEstimated;
}
}
$total.attr('level', level).append('<div/>').text(text);
};
}