Fix starring songs in the playing queue
This commit is contained in:
parent
fa1dec8e34
commit
9804561ebd
3 changed files with 72 additions and 10 deletions
|
@ -7,7 +7,9 @@
|
|||
angular.module('jamstash.queue.controller', [
|
||||
'ngLodash',
|
||||
'jamstash.player.service',
|
||||
'jamstash.subsonic.service',
|
||||
'jamstash.selectedsongs',
|
||||
'jamstash.notifications',
|
||||
'ui.sortable'
|
||||
])
|
||||
|
||||
|
@ -17,28 +19,32 @@ QueueController.$inject = [
|
|||
'$scope',
|
||||
'lodash',
|
||||
'player',
|
||||
'SelectedSongs'
|
||||
'SelectedSongs',
|
||||
'subsonic',
|
||||
'notifications'
|
||||
];
|
||||
|
||||
function QueueController(
|
||||
$scope,
|
||||
_,
|
||||
player,
|
||||
SelectedSongs
|
||||
SelectedSongs,
|
||||
subsonic,
|
||||
notifications
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var self = this;
|
||||
_.extend(self, {
|
||||
player: player,
|
||||
addSongToQueue : player.addSong,
|
||||
emptyQueue : emptyQueue,
|
||||
isPlayingSong : isPlayingSong,
|
||||
playSong : player.play,
|
||||
removeSelectedSongsFromQueue: removeSelectedSongsFromQueue,
|
||||
removeSongFromQueue : player.removeSong,
|
||||
shuffleQueue : shuffleQueue,
|
||||
toggleSelection : SelectedSongs.toggle
|
||||
toggleSelection : SelectedSongs.toggle,
|
||||
toggleStar : toggleStar
|
||||
});
|
||||
|
||||
function emptyQueue() {
|
||||
|
@ -61,6 +67,17 @@ function QueueController(
|
|||
$('#SideBar').stop().scrollTo('.header', 400);
|
||||
}
|
||||
|
||||
// TODO: Hyz: Duplicate of main-controller's toggleStar.
|
||||
// Refactor in a SubsonicSong service that'll hold all the common operations done on songs.
|
||||
function toggleStar(song) {
|
||||
var promise = subsonic.toggleStar(song).then(function (newState) {
|
||||
song.starred = newState;
|
||||
notifications.updateMessage('Favorite Updated!', true);
|
||||
});
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
$scope.$watch(function () {
|
||||
return player.getPlayingSong();
|
||||
}, function (newSong) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue