Pony.fm/public/scripts/app/controllers/track.coffee
2013-07-31 21:01:41 -05:00

18 lines
No EOL
561 B
CoffeeScript

window.pfm.preloaders['track'] = [
'tracks', '$state', 'playlists'
(tracks, $state, playlists) ->
$.when.all [tracks.fetch $state.params.id, playlists.refreshOwned(true)]
]
angular.module('ponyfm').controller "track", [
'$scope', 'tracks', '$state', 'playlists', 'auth'
($scope, tracks, $state, playlists, auth) ->
tracks.fetch($state.params.id).done (trackResponse) ->
$scope.track = trackResponse.track
$scope.playlists = []
if auth.data.isLogged
playlists.refreshOwned().done (lists) ->
$scope.playlists.push list for list in lists
]