blob: a18b5b1c0b1294339a45229107414bda6c95d3f5 (
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
|
define [
'issues/facets/base-facet'
'templates/issues'
], (
BaseFacet
) ->
$ = jQuery
class extends BaseFacet
template: Templates['issues-resolution-facet']
onRender: ->
super
value = @options.app.state.get('query')['resolved']
if value? && (!value || value == 'false')
@$('.js-facet').filter("[data-unresolved]").addClass 'active'
toggleFacet: (e) ->
unresolved = $(e.currentTarget).is "[data-unresolved]"
$(e.currentTarget).toggleClass 'active'
if unresolved
checked = $(e.currentTarget).is '.active'
value = if checked then 'false' else null
@options.app.state.updateFilter resolved: value, resolutions: null
else
@options.app.state.updateFilter resolved: null, resolutions: @getValue()
disable: ->
@options.app.state.updateFilter resolved: null, resolutions: null
sortValues: (values) ->
order = ['', 'FIXED', 'FALSE-POSITIVE', 'WONTFIX', 'REMOVED']
_.sortBy values, (v) -> order.indexOf v.val
|