28 if (discours) { |
28 if (discours) { |
29 sounds = sounds.filterBy('type', discours); |
29 sounds = sounds.filterBy('type', discours); |
30 } |
30 } |
31 if (date.length > 0) { |
31 if (date.length > 0) { |
32 var temp = sounds; |
32 var temp = sounds; |
33 sounds.map(function(elt, index){ |
33 sounds.map(function(elt){ |
34 if (date.indexOf(elt.get('created')) === -1){ |
34 if (date.indexOf(elt.get('created')) === -1){ |
35 temp = temp.without(elt); |
35 temp = temp.without(elt); |
36 } |
36 } |
37 }); |
37 }); |
38 sounds = temp; |
38 sounds = temp; |
42 } |
42 } |
43 return sounds; |
43 return sounds; |
44 }), |
44 }), |
45 actions: { |
45 actions: { |
46 deleteTag: function(query, item){ |
46 deleteTag: function(query, item){ |
47 var queryParams = {}; |
47 var queryParams = {}, |
|
48 newParams = null; |
48 if (query === 'date'){ |
49 if (query === 'date'){ |
49 var array = this.get('date'); |
50 newParams = this.get('date'); |
50 if(array.indexOf(item) !== -1) { |
51 if(newParams.indexOf(item) !== -1) { |
51 array.splice(array.indexOf(item), 1); |
52 newParams = newParams.splice(newParams.indexOf(item), 1); |
52 } |
53 } |
53 } |
54 } |
54 queryParams[query] = array || null; |
55 queryParams[query] = newParams; |
55 this.transitionToRoute({queryParams: queryParams}); |
56 this.transitionToRoute({queryParams: queryParams}); |
56 }, |
57 }, |
57 previous: function(){ |
58 changeSong: function(songDirection){ |
58 console.log("previous"); |
59 var direction = (songDirection === "next") ? 1 : -1; |
|
60 var index = this.get("filteredSounds").indexOf(this.get("currentItem")); |
|
61 if ( index !== -1){ |
|
62 if (typeof(this.get("filteredSounds").objectAt(index+direction)) !== 'undefined'){ |
|
63 return this.set('currentItem', this.get("filteredSounds").objectAt(index+direction)); |
|
64 } |
|
65 } |
|
66 return this.set('currentItem', this.get('filteredSounds').get('firstObject')); |
59 }, |
67 }, |
60 next: function(){ |
68 play: function(item){ |
61 console.log("next"); |
69 this.set("currentItem", item); |
|
70 Ember.$(".result-item").toggleClass("playing", false); |
|
71 Ember.$("#"+item.id).toggleClass("playing", true); |
62 }, |
72 }, |
63 details: function(item){ |
73 details: function(item){ |
64 if ($("#"+item.id).hasClass("details")){ |
74 if (Ember.$("#"+item.id).hasClass("details")){ |
65 $("#"+item.id).toggleClass("details", false); |
75 Ember.$("#"+item.id).toggleClass("details", false); |
66 } else{ |
76 } else{ |
67 $(".result-item").toggleClass("details", false); |
77 Ember.$(".result-item").toggleClass("details", false); |
68 $("#"+item.id).toggleClass("details", true); |
78 Ember.$("#"+item.id).toggleClass("details", true); |
69 } |
79 } |
70 }, |
80 }, |
71 toggleModal: function(item){ |
81 toggleModal: function(item){ |
72 this.set("isShowingModal", !this.isShowingModal); |
82 this.set("isShowingModal", !this.isShowingModal); |
73 this.set("currentDetails", item); |
83 this.set("currentDetails", item); |