cms/app-client/app/controllers/application.js
changeset 58 6c03fafb6b62
parent 51 70dff07a76ff
child 61 bbc8a582fcc3
equal deleted inserted replaced
57:36dc51dd60e9 58:6c03fafb6b62
     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   queryParams: ['location', 'langue'],
     4   queryParams: ['location', 'langue', 'discours', 'date', 'thematique'],
     5   location: null,
     5   location: null,
     6   langue: null,
     6   langue: null,
     7   filteredSounds: Ember.computed('location', 'langue', 'model', function() {
     7   discours: null,
       
     8   date: null,
       
     9   thematique: null,
       
    10   filteredSounds: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() {
     8     var location = this.get('location');
    11     var location = this.get('location');
     9     var langue = this.get('langue');
    12     var langue = this.get('langue');
       
    13     var discours = this.get('discours');
       
    14     var date = this.get('date');
       
    15     // var thematique = this.get('thematique');
       
    16 
    10     var sounds = this.get('model');
    17     var sounds = this.get('model');
    11 
    18 
    12     if (location) {
    19     if (location) {
    13       sounds = sounds.filterBy('location', location);
    20       sounds = sounds.filterBy('spatial', location);
    14     }
    21     }
    15 
       
    16     if (langue) {
    22     if (langue) {
    17       sounds = sounds.filterBy('language', langue);
    23       sounds = sounds.filterBy('language', langue);
    18     }
    24     }
       
    25     if (discours) {
       
    26       sounds = sounds.filterBy('type', discours);
       
    27     }
       
    28     if (date) {
       
    29       sounds = sounds.filterBy('created', parseInt(date));
       
    30     }
       
    31     // if (thematique) {
       
    32     //   sounds = sounds.filterBy('thematique', thematique);
       
    33     // }
    19 
    34 
    20     return sounds;
    35     return sounds;
    21   })
    36   }),
       
    37   model(params){
       
    38     return this.store.query('sound', params);
       
    39   },
       
    40   actions: {
       
    41     deleteTag: function(query){
       
    42       var queryParams = {};
       
    43       queryParams[query]  = null;
       
    44       this.transitionToRoute({queryParams: queryParams});
       
    45     }
       
    46   }
    22 });
    47 });