introduce new action "play" to play the sounds and "details" to show more
authornowmad@23.1.168.192.in-addr.arpa
Thu, 17 Dec 2015 12:12:06 +0100
changeset 61 bbc8a582fcc3
parent 60 9cf73ae600c0
child 62 6fc7d50c6b5d
introduce new action "play" to play the sounds and "details" to show more
cms/app-client/app/controllers/application.js
--- 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);
+      }
     }
   }
 });