When playing a song, the queue is scrolled to display it

This commit is contained in:
Hyzual 2015-01-11 10:52:32 +01:00
parent 392ef74eba
commit 425bac6676
3 changed files with 33 additions and 6 deletions

View file

@ -1,3 +1,9 @@
/**
* jamstash.queue.controller Module
*
* Manages the playing queue. Gives access to the player service's queue-related functions,
* like adding, removing and shuffling the queue.
*/
angular.module('jamstash.queue.controller', ['jamstash.player.service'])
.controller('QueueController', ['$scope', 'globals', 'player',
@ -5,7 +11,6 @@ angular.module('jamstash.queue.controller', ['jamstash.player.service'])
'use strict';
$scope.settings = globals.settings;
$scope.player = player;
$scope.itemType = 'pl'; // TODO: Hyz: What is this ?
$scope.playSong = function (song) {
player.play(song);
@ -37,5 +42,14 @@ angular.module('jamstash.queue.controller', ['jamstash.player.service'])
return angular.equals(song, player.getPlayingSong());
};
$scope.$watch(function () {
return player.getPlayingSong();
}, function (newSong) {
if(newSong !== undefined) {
//TODO: Hyz: Shouldn't it be in a directive ?
$('#SideBar').stop().scrollTo('.song.id' + newSong.id, 400);
}
});
//TODO: Hyz: updateFavorite - leave in rootScope ?
}]);