Fix for broken track formatting in HWC announcement

This commit is contained in:
Josef Citrine 2016-12-29 00:14:52 +00:00
parent 7f566b266b
commit e30400cab0
3 changed files with 23 additions and 6 deletions

View file

@ -4,7 +4,7 @@
</div>
<div class="announce-tracks">
<ul class="tracks-listing">
<li ng-repeat="track in announcement.parsedTracks track by track.id" ng-class="{'can-favourite': auth.isLogged, 'is-favourited': auth.isLogged && track.user_data.is_favourited, 'is-playing': track.isPlaying, 'has-played': auth.isLogged && track.user_data.views}">
<li ng-repeat="track in announcement.parsedTracks track by track.place" ng-class="{'can-favourite': auth.isLogged, 'is-favourited': auth.isLogged && track.user_data.is_favourited, 'is-playing': track.isPlaying, 'has-played': auth.isLogged && track.user_data.views}">
<div class="image">
<a href="#" class="play-button" pfm-eat-click ng-click="play(track)">
<i class="fa fa-play" ng-if="!track.isPlaying"></i>

View file

@ -39,10 +39,27 @@ module.exports = angular.module('ponyfm').controller "dashboard", [
if $scope.announcement.tracks.length > 0
console.log($scope.announcement.tracks)
$scope.announcement.parsedTracks = []
for track in $scope.announcement.tracks
tempTracks = []
# Not the greatest, but sod it
for track, i in $scope.announcement.tracks
console.log(i)
tracks.fetch(track, false).done (trackResponse) ->
$scope.announcement.parsedTracks.push(trackResponse.track)
console.log(trackResponse)
theTrack = trackResponse.track
$scope.announcement.tracks.map((obj, index) ->
if obj == theTrack.id
theTrack.place = index
)
tempTracks.push(theTrack)
console.log(tempTracks)
if tempTracks.length == $scope.announcement.tracks.length
tempTracks.sort((a,b) ->
return a.place - b.place
)
$scope.announcement.parsedTracks = tempTracks
dashboard.refresh().done (res) ->
$scope.recentTracks = res.recent_tracks