|
@@ -29,13 +29,32 @@ $(document).on 'turbolinks:load', ->
|
29
|
29
|
@filterparticipants = (e) ->
|
30
|
30
|
show = e.target.value
|
31
|
31
|
if (show != 'all')
|
32
|
|
- selector = "[data-subgroup-id=" + e.target.value + "]"
|
33
|
|
- $('.participant-row').hide()
|
34
|
|
- $(selector).show()
|
|
32
|
+ selector = "[data-subgroup-id=" + e.target.value + "]"
|
|
33
|
+ $('.participant-row').hide()
|
|
34
|
+ $(selector).show()
|
|
35
|
+ @updatecounts(show)
|
35
|
36
|
else
|
36
|
37
|
$('.participant-row').show()
|
|
38
|
+ @updatecounts()
|
37
|
39
|
|
38
|
40
|
@updatecounts = (subgroupid) ->
|
39
|
|
- selector = 'tr.participant-row'
|
|
41
|
+ selector = 'tr.countable.participant-row'
|
|
42
|
+ selectorend = '[style!="display: none;"]'
|
|
43
|
+
|
40
|
44
|
if (subgroupid)
|
41
|
|
- selector = 'tr.participant-row[data-subgroup-id=' + subgroupid + ']'
|
|
45
|
+ selectorend = '[data-subgroup-id=' + subgroupid + ']' + selectorend
|
|
46
|
+
|
|
47
|
+ pselect = selector + '.success' + selectorend
|
|
48
|
+ uselect = selector + '.warning' + selectorend
|
|
49
|
+ aselect = selector + '.danger' + selectorend
|
|
50
|
+
|
|
51
|
+ numall = $(selector + selectorend).length
|
|
52
|
+ numpresent = $(pselect).length
|
|
53
|
+ numunknown = $(uselect).length
|
|
54
|
+ numabsent = $(aselect).length
|
|
55
|
+
|
|
56
|
+ $('.state-count.all-count').html(numall)
|
|
57
|
+ $('.state-count.present-count').html(numpresent)
|
|
58
|
+ $('.state-count.unknown-count').html(numunknown)
|
|
59
|
+ $('.state-count.absent-count').html(numabsent)
|
|
60
|
+ [numpresent, numabsent, numunknown]
|