Skip to content

Commit 5fa7d20

Browse files
committed
stop playlist from reloading. fixes #518
1 parent 631ef17 commit 5fa7d20

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

app/public/js/playlists/playlistsCtrl.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ app.controller('PlaylistsCtrl', function (
1111
$stateParams,
1212
notificationFactory,
1313
modalFactory,
14-
utilsService
14+
utilsService,
15+
queueService
1516
) {
1617
var endpoint = 'me/playlists'
1718
, params = '';
@@ -74,11 +75,13 @@ app.controller('PlaylistsCtrl', function (
7475
$log.log(response);
7576
return $q.reject(response.data);
7677
}).finally(function() {
77-
$state.transitionTo($state.current, $stateParams, {
78-
reload: true,
79-
inherit: false,
80-
notify: true
81-
});
78+
var inQueue = queueService.find(songId);
79+
80+
$('#' + songId).remove();
81+
82+
if ( inQueue ) {
83+
queueService.remove(inQueue);
84+
}
8285
})
8386

8487
}, function(error) {
@@ -105,11 +108,7 @@ app.controller('PlaylistsCtrl', function (
105108
notificationFactory.error("Something went wrong!");
106109
})
107110
.finally(function() {
108-
$state.transitionTo($state.current, $stateParams, {
109-
reload: true,
110-
inherit: false,
111-
notify: true
112-
});
111+
$('#' + playlistId).remove();
113112
});
114113
});
115114
};

app/views/playlists/playlists.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ <h1> {{ title }}</h1>
88
ng-class="{ playlist: data.kind }"
99
data-kind="{{ data.kind }}"
1010
ng-if="data.kind == 'playlist'"
11-
data-playlist-hidden="true" >
11+
data-playlist-hidden="true"
12+
id="{{data.id}}">
1213

1314
<h4 class="songList_item_song_user" collapsible>{{ data.title }} playlist - <span>show</span></h4>
1415
<span class="mediaBox_item_info">
@@ -26,7 +27,8 @@ <h4 class="songList_item_song_user" collapsible>{{ data.title }} playlist - <spa
2627
ng-repeat="tracks in data.tracks"
2728
ng-class="{ active: hover }"
2829
ng-mouseover="hover = true"
29-
ng-mouseleave="hover = false" >
30+
ng-mouseleave="hover = false"
31+
id="{{tracks.id}}">
3032

3133
<div class="songList_item_container_artwork">
3234
<span class="songList_item_song_button"
@@ -64,6 +66,4 @@ <h4 class="songList_item_song_user">
6466
</div>
6567
<!-- Song list wrapper / end -->
6668

67-
<div ng-include="'views/common/loading.html'"></div>
68-
6969
</div>

0 commit comments

Comments
 (0)