# HG changeset patch # User nowmad@23.1.168.192.in-addr.arpa # Date 1450350726 -3600 # Node ID bbc8a582fcc376e2391f80c4fdcc7ae686d94fbf # Parent 9cf73ae600c03cd3f1e7846a9fc898576c7fe6ff introduce new action "play" to play the sounds and "details" to show more diff -r 9cf73ae600c0 -r bbc8a582fcc3 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); + } } } });