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