2013-08-01 04:01:41 +02:00
|
|
|
window.pfm.preloaders['album'] = [
|
|
|
|
'albums', '$state', 'playlists'
|
|
|
|
(albums, $state, playlists) ->
|
|
|
|
$.when.all [albums.fetch $state.params.id, playlists.refreshOwned(true)]
|
|
|
|
]
|
|
|
|
|
|
|
|
angular.module('ponyfm').controller "album", [
|
2013-08-29 05:19:24 +02:00
|
|
|
'$scope', 'albums', '$state', 'playlists', 'auth', '$dialog'
|
|
|
|
($scope, albums, $state, playlists, auth, $dialog) ->
|
|
|
|
album = null
|
|
|
|
|
2013-08-01 04:01:41 +02:00
|
|
|
albums.fetch($state.params.id).done (albumResponse) ->
|
|
|
|
$scope.album = albumResponse.album
|
2013-08-29 05:19:24 +02:00
|
|
|
album = albumResponse.album
|
2013-08-01 04:01:41 +02:00
|
|
|
|
|
|
|
$scope.playlists = []
|
|
|
|
|
2013-08-29 05:19:24 +02:00
|
|
|
$scope.share = () ->
|
|
|
|
dialog = $dialog.dialog
|
|
|
|
templateUrl: '/templates/partials/album-share-dialog.html',
|
|
|
|
controller: ['$scope', ($scope) -> $scope.album = album; $scope.close = () -> dialog.close()]
|
|
|
|
dialog.open()
|
|
|
|
|
2013-08-01 04:01:41 +02:00
|
|
|
if auth.data.isLogged
|
|
|
|
playlists.refreshOwned().done (lists) ->
|
|
|
|
$scope.playlists.push list for list in lists
|
|
|
|
]
|