Pony.fm/resources/assets/scripts/app/controllers/artist.coffee

18 lines
580 B
CoffeeScript
Raw Normal View History

2015-08-31 17:42:21 +02:00
window.pfm.preloaders['artist'] = [
2015-10-25 03:35:37 +01:00
'artists', '$state'
(artists, $state) ->
artists.fetch $state.params.slug, true
2015-08-31 17:42:21 +02:00
]
angular.module('ponyfm').controller "artist", [
2015-10-25 03:35:37 +01:00
'$scope', 'artists', '$state', 'follow'
($scope, artists, $state, follow) ->
artists.fetch($state.params.slug)
.done (artistResponse) ->
$scope.artist = artistResponse.artist
2015-08-31 17:42:21 +02:00
2015-10-25 03:35:37 +01:00
$scope.toggleFollow = () ->
follow.toggle('artist', $scope.artist.id).then (res) ->
$scope.artist.user_data.is_following = res.is_followed
]