This commit is contained in:
Trevor Squillario 2014-02-22 21:30:27 -05:00
parent c46265340c
commit 09ac96526e
2 changed files with 20 additions and 4 deletions

View file

@ -1,5 +1,5 @@
JamStash.controller('AppCtrl', JamStash.controller('AppCtrl',
function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils, globals, model, notifications, player) { function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore, utils, globals, model, notifications, player) {
$rootScope.settings = globals.settings; $rootScope.settings = globals.settings;
$rootScope.song = []; $rootScope.song = [];
$rootScope.queue = []; $rootScope.queue = [];
@ -313,6 +313,17 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
var next = $rootScope.queue[0]; var next = $rootScope.queue[0];
$rootScope.playSong(false, next); $rootScope.playSong(false, next);
}; };
$scope.playFrom = function (index) {
var from = $rootScope.song.slice(index,$rootScope.song.length);
angular.forEach(from, function (item, key) {
$scope.selectedSongs.push(item);
item.selected = true;
});
$rootScope.queue = [];
$scope.addSongsToQueue();
var next = $rootScope.queue[0];
$rootScope.playSong(false, next);
};
$scope.selectNone = function () { $scope.selectNone = function () {
angular.forEach($rootScope.song, function (item, key) { angular.forEach($rootScope.song, function (item, key) {
$scope.selectedSongs = []; $scope.selectedSongs = [];
@ -330,6 +341,10 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
$scope.selectedSongs.length = 0; $scope.selectedSongs.length = 0;
} }
}; };
$scope.removeSong = function (item) {
var index = $rootScope.song.indexOf(item)
$rootScope.song.splice(index, 1);
}
$scope.isActive = function (route) { $scope.isActive = function (route) {
return route === $location.path(); return route === $location.path();
}; };

View file

@ -1,8 +1,9 @@
<li class="row song" ng-repeat="o in song | limitTo:totalDisplayed" ng-click="selectSong(o)" ng-dblclick="playSong(false, o)" ng-class="{'selected': o.selected, 'playing': o.playing}" data-bind="attr: { id: id, title: description }"> <li class="row song" ng-repeat="o in song | limitTo:totalDisplayed" ng-click="selectSong(o)" ng-dblclick="playSong(false, o)" ng-class="{'selected': o.selected, 'playing': o.playing}" data-bind="attr: { id: id, title: description }">
<div class="itemactions"> <div class="itemactions">
<a class="add" href="" title="Add To Play Queue" ng-click="addSongToQueue(o)" stop-event="click"></a> <a class="add" href="" title="Add To Queue" ng-click="addSongToQueue(o)" stop-event="click"></a>
<a class="remove" href="" title="Remove"></a> <a class="remove" href="" title="Remove From Queue"></a>
<a class="play" href="" title="Play" ng-click="playSong(false, o)" stop-event="click"></a><a class="download" href="" title="Download"></a> <a class="play" href="" title="Start Playing From This Song" ng-click="playFrom($index)" stop-event="click"></a>
<a class="download" href="" title="Download Song" ng-click="download(o.id)"></a>
<a href="" title="Favorite" ng-class="{'favorite': o.starred, 'rate': !o.starred}" ng-click="updateFavorite(o)" stop-event="click"></a> <a href="" title="Favorite" ng-class="{'favorite': o.starred, 'rate': !o.starred}" ng-click="updateFavorite(o)" stop-event="click"></a>
<div class="clear"></div> <div class="clear"></div>
</div> </div>