cms/app-client/app/controllers/application.js
changeset 61 bbc8a582fcc3
parent 58 6c03fafb6b62
child 72 9a7ea5349882
--- a/cms/app-client/app/controllers/application.js	Thu Dec 17 12:11:31 2015 +0100
+++ b/cms/app-client/app/controllers/application.js	Thu Dec 17 12:12:06 2015 +0100
@@ -7,6 +7,7 @@
   discours: null,
   date: null,
   thematique: null,
+  currentItem: {title: "example", master: 'http://www.noiseaddicts.com/samples_1w72b820/3921.mp3'},
   filteredSounds: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() {
     var location = this.get('location');
     var langue = this.get('langue');
@@ -15,6 +16,7 @@
     // var thematique = this.get('thematique');
 
     var sounds = this.get('model');
+    console.log("sounds filtered ? ", sounds);
 
     if (location) {
       sounds = sounds.filterBy('spatial', location);
@@ -34,14 +36,25 @@
 
     return sounds;
   }),
-  model(params){
-    return this.store.query('sound', params);
-  },
   actions: {
     deleteTag: function(query){
       var queryParams = {};
       queryParams[query]  = null;
       this.transitionToRoute({queryParams: queryParams});
+    },
+    play: function(item){
+      this.set("currentItem", item);
+      $("#audio-player").load();
+      $(".result-item").toggleClass("playing", false);
+      $("#"+item.id).toggleClass("playing", true);
+    },
+    details: function(item){
+      if ($("#"+item.id).hasClass("details")){
+          $("#"+item.id).toggleClass("details", false);
+      } else{
+        $(".result-item").toggleClass("details", false);
+        $("#"+item.id).toggleClass("details", true);
+      }
     }
   }
 });