add observable on currentItem to update the icon of the item being played
authornowmad@23.1.168.192.in-addr.arpa
Wed, 20 Jan 2016 10:38:09 +0100
changeset 88 1547a32aef60
parent 87 24fef043ea0b
child 89 89be68e13215
add observable on currentItem to update the icon of the item being played
cms/app-client/app/controllers/application.js
--- a/cms/app-client/app/controllers/application.js	Wed Jan 20 00:15:46 2016 +0100
+++ b/cms/app-client/app/controllers/application.js	Wed Jan 20 10:38:09 2016 +0100
@@ -42,6 +42,10 @@
     }
     return sounds;
   }),
+  currentItemChanged: Ember.observer('currentItem', function() {
+    Ember.$(".result-item").toggleClass("playing", false);
+    Ember.$("#"+this.get('currentItem').id).toggleClass("playing", true);
+  }),
   actions: {
     deleteTag: function(query, item){
       var queryParams = {},
@@ -67,8 +71,6 @@
     },
     play: function(item){
       this.set("currentItem", item);
-      Ember.$(".result-item").toggleClass("playing", false);
-      Ember.$("#"+item.id).toggleClass("playing", true);
     },
     details: function(item){
       if (Ember.$("#"+item.id).hasClass("details")){