blob: 30811e790d7cd759d08582d59405c9544b280daa (
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
44
45
46
47
48
49
50
51
52
53
54
|
define [
'backbone.marionette'
'issues/facets/base-facet'
'issues/facets/severity-facet'
'issues/facets/status-facet'
'issues/facets/project-facet'
'issues/facets/assignee-facet'
'issues/facets/rule-facet'
'issues/facets/resolution-facet'
'issues/facets/creation-date-facet'
], (
Marionette
BaseFacet
SeverityFacet
StatusFacet
ProjectFacet
AssigneeFacet
RuleFacet
ResolutionFacet
CreationDateFacet
) ->
class extends Marionette.CollectionView
className: 'issues-facets-list'
getItemView: (model) ->
switch model.get 'property'
when 'severities' then SeverityFacet
when 'statuses' then StatusFacet
when 'assignees' then AssigneeFacet
when 'resolutions' then ResolutionFacet
when 'created' then CreationDateFacet
when 'componentRootUuids' then ProjectFacet
when 'rules' then RuleFacet
when 'creationDate' then CreationDateFacet
else BaseFacet
itemViewOptions: ->
app: @options.app
collectionEvents: ->
'change:enabled': 'updateState'
updateState: ->
enabledFacets = @collection.filter (model) -> model.get('enabled')
enabledFacetIds = enabledFacets.map (model) -> model.id
console.log enabledFacetIds
@options.app.state.set facets: enabledFacetIds
|