1
|
|
|
$(function() { |
2
|
|
|
var filter = Filter.init({ |
|
|
|
|
3
|
|
|
filterForms: [ |
4
|
|
|
'#depmon-filter' |
5
|
|
|
], |
6
|
|
|
list: '#depmon-list', |
7
|
|
|
storage: true, |
8
|
|
|
afterApplyFilter: function () { |
9
|
|
|
// hide list header with no more entries in the list |
10
|
|
|
$('.list-header').removeClass('hidden'); |
11
|
|
|
if (!$('#depmon-filter input[name="overview"]:checked').length) { |
12
|
|
|
$('#depmon-list ul:not(.header)').each(function () { |
13
|
|
|
var list = $(this); |
14
|
|
|
if (list.find('li:not(.hidden):not(.list-header)').length === 0) { |
15
|
|
|
var listHeader = $(list.find('li.list-header'))[0]; |
16
|
|
|
$(listHeader).addClass('hidden'); |
17
|
|
|
} |
18
|
|
|
}); |
19
|
|
|
} |
20
|
|
|
}, |
21
|
|
|
debug: true |
22
|
|
|
}); |
23
|
|
|
|
24
|
|
|
$('.filter-reset').click(function () { |
25
|
|
|
filter.reset(); |
26
|
|
|
filter.applyFilter(null); |
27
|
|
|
$('.collapse').collapse('hide'); |
28
|
|
|
}); |
29
|
|
|
|
30
|
|
|
// ToDo: Combine these event listener to a more generic one |
31
|
|
|
// Quick filter for project |
32
|
|
|
$('.filter-project').click(function() { |
33
|
|
|
var project = $(this).attr('data-project'); |
34
|
|
|
var object = { |
35
|
|
|
'project': [ |
36
|
|
|
project |
37
|
|
|
] |
38
|
|
|
}; |
39
|
|
|
filter.applyFilter(object); |
40
|
|
|
$('#filter-project-collapse').collapse('show'); |
41
|
|
|
}); |
42
|
|
|
|
43
|
|
|
// Quick filter for dependency |
44
|
|
|
$('.filter-dependency').click(function() { |
45
|
|
|
var dependency = $(this).attr('data-dependency'); |
46
|
|
|
var object = { |
47
|
|
|
'name': [ |
48
|
|
|
dependency |
49
|
|
|
] |
50
|
|
|
}; |
51
|
|
|
filter.applyFilter(object); |
52
|
|
|
}); |
53
|
|
|
|
54
|
|
|
// Quick filter for type |
55
|
|
|
$('.filter-type').click(function() { |
56
|
|
|
var type = $(this).attr('data-type'); |
57
|
|
|
var object = { |
58
|
|
|
'project-type': [ |
59
|
|
|
type |
60
|
|
|
] |
61
|
|
|
}; |
62
|
|
|
filter.applyFilter(object); |
63
|
|
|
$('#filter-type-collapse').collapse('show'); |
64
|
|
|
}); |
65
|
|
|
|
66
|
|
|
// Quick filter for state and the project |
67
|
|
|
$('.filter-state-project').click(function() { |
68
|
|
|
var project = $(this).attr('data-project'); |
69
|
|
|
var state = $(this).attr('data-state'); |
70
|
|
|
var object = { |
71
|
|
|
'project': [ |
72
|
|
|
project |
73
|
|
|
], |
74
|
|
|
'state': [ |
75
|
|
|
state |
76
|
|
|
] |
77
|
|
|
}; |
78
|
|
|
filter.applyFilter(object); |
79
|
|
|
$('#filter-project-collapse').collapse('show'); |
80
|
|
|
$('#filter-state-collapse').collapse('show'); |
81
|
|
|
}); |
82
|
|
|
|
83
|
|
|
// Quick filter for type |
84
|
|
|
$('.filter-required-project').click(function() { |
85
|
|
|
var project = $(this).attr('data-project'); |
86
|
|
|
var required = $(this).attr('data-required'); |
87
|
|
|
var object = { |
88
|
|
|
'project': [ |
89
|
|
|
project |
90
|
|
|
], |
91
|
|
|
'required': [ |
92
|
|
|
required |
93
|
|
|
] |
94
|
|
|
}; |
95
|
|
|
filter.applyFilter(object); |
96
|
|
|
$('#filter-project-collapse').collapse('show'); |
97
|
|
|
}); |
98
|
|
|
}); |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.