1 import Ember from 'ember'; |
1 import Ember from 'ember'; |
2 |
2 |
3 export default Ember.Controller.extend({ |
3 export default Ember.Controller.extend({ |
4 |
4 |
5 queryParams: ['location', 'langue', 'discours', 'date', 'thematique', 'detail'], |
5 queryParams: ['location', 'langue', 'discours', 'date', 'thematique', 'detail'], |
|
6 |
|
7 filter: Ember.inject.service(), |
|
8 |
|
9 date: [], |
|
10 setDateFilter: Ember.observer('date', function() { |
|
11 this.get('filter').set('date', this.get('date')); |
|
12 }), |
|
13 setDate: Ember.observer('filter.date', function() { |
|
14 this.set('date', this.get('filter').get('date')); |
|
15 }), |
|
16 discours: null, |
|
17 setDiscoursFilter: Ember.observer('discours', function() { |
|
18 this.get('filter').set('discours', this.get('discours')); |
|
19 }), |
|
20 setDiscours: Ember.observer('filter.discours', function() { |
|
21 this.set('discours', this.get('filter').get('discours')); |
|
22 }), |
|
23 langue: null, |
|
24 setLangueFilter: Ember.observer('langue', function() { |
|
25 this.get('filter').set('langue', this.get('langue')); |
|
26 }), |
|
27 setLangue: Ember.observer('filter.langue', function() { |
|
28 this.set('langue', this.get('filter').get('langue')); |
|
29 }), |
6 location: null, |
30 location: null, |
7 langue: null, |
31 setLocationFilter: Ember.observer('location', function() { |
8 discours: null, |
32 this.get('filter').set('location', this.get('location')); |
9 date: [], |
33 }), |
|
34 setLocation: Ember.observer('filter.location', function() { |
|
35 this.set('location', this.get('filter').get('location')); |
|
36 }), |
10 thematique: null, |
37 thematique: null, |
|
38 setThematiqueFilter: Ember.observer('thematique', function() { |
|
39 this.get('filter').set('thematique', this.get('thematique')); |
|
40 }), |
|
41 setThematique: Ember.observer('filter.thematique', function() { |
|
42 this.set('thematique', this.get('filter').get('thematique')); |
|
43 }), |
|
44 |
11 detail: null, |
45 detail: null, |
12 |
46 |
13 dateIntervals: Ember.computed('date', function() { |
47 dateIntervals: Ember.computed('date', function() { |
14 var intervals = []; |
48 var intervals = []; |
15 this.get('date').forEach(function(date) { |
49 this.get('date').forEach(function(date) { |
39 |
73 |
40 modalItem: Ember.computed('detail', function() { |
74 modalItem: Ember.computed('detail', function() { |
41 return this.store.findRecord('document', this.get('detail')); |
75 return this.store.findRecord('document', this.get('detail')); |
42 }), |
76 }), |
43 |
77 |
44 filteredDocuments: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() { |
78 filteredDocuments: Ember.computed('filter.location', 'filter.langue', 'filter.discours', 'filter.date', 'filter.thematique', 'model', function() { |
45 var location = this.get('location'); |
79 var location = this.get('location'); |
46 var langue = this.get('langue'); |
80 var langue = this.get('langue'); |
47 var discours = this.get('discours'); |
81 var discours = this.get('discours'); |
48 var date = this.get('date'); |
82 var date = this.get('date'); |
49 var thematique = this.get('thematique'); |
83 var thematique = this.get('thematique'); |