cms/app-client/app/controllers/application.js
changeset 58 6c03fafb6b62
parent 51 70dff07a76ff
child 61 bbc8a582fcc3
--- a/cms/app-client/app/controllers/application.js	Tue Dec 15 17:23:11 2015 +0100
+++ b/cms/app-client/app/controllers/application.js	Tue Dec 15 17:23:35 2015 +0100
@@ -1,22 +1,47 @@
 import Ember from 'ember';
 
 export default Ember.Controller.extend({
-  queryParams: ['location', 'langue'],
+  queryParams: ['location', 'langue', 'discours', 'date', 'thematique'],
   location: null,
   langue: null,
-  filteredSounds: Ember.computed('location', 'langue', 'model', function() {
+  discours: null,
+  date: null,
+  thematique: null,
+  filteredSounds: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() {
     var location = this.get('location');
     var langue = this.get('langue');
+    var discours = this.get('discours');
+    var date = this.get('date');
+    // var thematique = this.get('thematique');
+
     var sounds = this.get('model');
 
     if (location) {
-      sounds = sounds.filterBy('location', location);
+      sounds = sounds.filterBy('spatial', location);
     }
-
     if (langue) {
       sounds = sounds.filterBy('language', langue);
     }
+    if (discours) {
+      sounds = sounds.filterBy('type', discours);
+    }
+    if (date) {
+      sounds = sounds.filterBy('created', parseInt(date));
+    }
+    // if (thematique) {
+    //   sounds = sounds.filterBy('thematique', thematique);
+    // }
 
     return sounds;
-  })
+  }),
+  model(params){
+    return this.store.query('sound', params);
+  },
+  actions: {
+    deleteTag: function(query){
+      var queryParams = {};
+      queryParams[query]  = null;
+      this.transitionToRoute({queryParams: queryParams});
+    }
+  }
 });