mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-27 07:17:59 +01:00
27 lines
858 B
CoffeeScript
27 lines
858 B
CoffeeScript
|
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", [
|
||
|
'$scope', 'albums', '$state', 'playlists', 'auth', '$dialog'
|
||
|
($scope, albums, $state, playlists, auth, $dialog) ->
|
||
|
album = null
|
||
|
|
||
|
albums.fetch($state.params.id).done (albumResponse) ->
|
||
|
$scope.album = albumResponse.album
|
||
|
album = albumResponse.album
|
||
|
|
||
|
$scope.playlists = []
|
||
|
|
||
|
$scope.share = () ->
|
||
|
dialog = $dialog.dialog
|
||
|
templateUrl: '/templates/partials/album-share-dialog.html',
|
||
|
controller: ['$scope', ($scope) -> $scope.album = album; $scope.close = () -> dialog.close()]
|
||
|
dialog.open()
|
||
|
|
||
|
if auth.data.isLogged
|
||
|
playlists.refreshOwned().done (lists) ->
|
||
|
$scope.playlists.push list for list in lists
|
||
|
]
|