cms/app-client/app/controllers/application.js
changeset 51 70dff07a76ff
child 58 6c03fafb6b62
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/controllers/application.js	Fri Dec 11 13:13:47 2015 +0100
@@ -0,0 +1,22 @@
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+  queryParams: ['location', 'langue'],
+  location: null,
+  langue: null,
+  filteredSounds: Ember.computed('location', 'langue', 'model', function() {
+    var location = this.get('location');
+    var langue = this.get('langue');
+    var sounds = this.get('model');
+
+    if (location) {
+      sounds = sounds.filterBy('location', location);
+    }
+
+    if (langue) {
+      sounds = sounds.filterBy('language', langue);
+    }
+
+    return sounds;
+  })
+});