mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 06:27:59 +01:00
Made playlist track delete actually functional
This commit is contained in:
parent
b22ddcbf5c
commit
583171669f
2 changed files with 27 additions and 10 deletions
17
public/templates/partials/delete-playlist-track-dialog.html
Normal file
17
public/templates/partials/delete-playlist-track-dialog.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<div class="modal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" ng-show="title">
|
||||
<button type="button" class="close" ng-click="$hide()">×</button>
|
||||
<h4 class="modal-title">Remove {{ track.title }} from playlist</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to delete {{ track.title }}?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" ng-click="confirmDeleteTrack();$hide()">Yes</button>
|
||||
<button type="button" class="btn btn-primary" ng-click="$hide()">No</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -32,16 +32,16 @@ module.exports = angular.module('ponyfm').directive 'pfmTracksList', () ->
|
|||
$scope.playlist and $scope.auth.isLogged and $scope.playlist.user.id == $scope.auth.user.id
|
||||
|
||||
$scope.removeFromPlaylist = (track) ->
|
||||
#$dialog.messageBox "Remove #{track.title} from playlist",
|
||||
# "Are you sure you want to delete \"#{track.title}\"?", [
|
||||
# { result: 'ok', label: 'Yes', cssClass: 'btn-danger' },
|
||||
# { result: 'cancel', label: 'No', cssClass: 'btn-primary' }
|
||||
# ]
|
||||
#.open().then (res) ->
|
||||
# return if res is 'cancel'
|
||||
# playlists.removeTrackFromPlaylist $scope.playlist?.id, track.id
|
||||
# .done ->
|
||||
# $scope.tracks = _.reject $scope.tracks, (t) -> t.id == track.id
|
||||
$scope.track = track
|
||||
dialog = $modal
|
||||
templateUrl: '/templates/partials/delete-playlist-track-dialog.html'
|
||||
scope: $scope,
|
||||
show: true
|
||||
|
||||
$scope.confirmDeleteTrack = () ->
|
||||
playlists.removeTrackFromPlaylist $scope.playlist?.id, $scope.track.id
|
||||
.done ->
|
||||
$scope.tracks = _.reject $scope.tracks, (t) -> t.id == $scope.track.id
|
||||
|
||||
$scope.toggleFavourite = (track) ->
|
||||
favourites.toggle('track', track.id).done (res) ->
|
||||
|
|
Loading…
Reference in a new issue