mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-27 15:27:58 +01:00
28 lines
602 B
CoffeeScript
28 lines
602 B
CoffeeScript
|
angular.module('ponyfm').controller "playlist-form", [
|
||
|
'$scope', 'dialog', 'playlists', 'playlist'
|
||
|
($scope, dialog, playlists, playlist) ->
|
||
|
$scope.isLoading = false
|
||
|
$scope.form = playlist
|
||
|
$scope.isNew = playlist.id == undefined
|
||
|
|
||
|
$scope.errors = {}
|
||
|
|
||
|
$scope.createPlaylist = () ->
|
||
|
$scope.isLoading = true
|
||
|
def =
|
||
|
if $scope.isNew
|
||
|
playlists.createPlaylist($scope.form)
|
||
|
else
|
||
|
playlists.editPlaylist($scope.form)
|
||
|
|
||
|
def
|
||
|
.done ->
|
||
|
dialog.close()
|
||
|
|
||
|
.fail (errors)->
|
||
|
$scope.errors = errors
|
||
|
$scope.isLoading = false
|
||
|
|
||
|
$scope.close = () -> dialog.close()
|
||
|
]
|