blob: 15e8867a88d8e9b95da119e527bd74a7abaceb44 (
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
|
import Marionette from 'backbone.marionette';
import BaseFacet from './facets/base-facet';
export default Marionette.CollectionView.extend({
className: 'search-navigator-facets-list',
childViewOptions: function () {
return {
app: this.options.app
};
},
getChildView: function () {
return BaseFacet;
},
collectionEvents: function () {
return {
'change:enabled': 'updateState'
};
},
updateState: function () {
var enabledFacets = this.collection.filter(function (model) {
return model.get('enabled');
}),
enabledFacetIds = enabledFacets.map(function (model) {
return model.id;
});
this.options.app.state.set({ facets: enabledFacetIds });
}
});
|