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>
<div class="announce-tracks"> <div class="announce-tracks">
<ul class="tracks-listing"> <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"> <div class="image">
<a href="#" class="play-button" pfm-eat-click ng-click="play(track)"> <a href="#" class="play-button" pfm-eat-click ng-click="play(track)">
<i class="fa fa-play" ng-if="!track.isPlaying"></i> <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 if $scope.announcement.tracks.length > 0
console.log($scope.announcement.tracks) console.log($scope.announcement.tracks)
$scope.announcement.parsedTracks = [] $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) -> tracks.fetch(track, false).done (trackResponse) ->
$scope.announcement.parsedTracks.push(trackResponse.track) theTrack = trackResponse.track
console.log(trackResponse) $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) -> dashboard.refresh().done (res) ->
$scope.recentTracks = res.recent_tracks $scope.recentTracks = res.recent_tracks

View file

@ -238,11 +238,11 @@
} }
&:hover { &:hover {
background: rgba(0,0,0,0.2); background: rgba(0, 0, 0, 0.2);
} }
&.is-playing { &.is-playing {
background: rgba(0,0,0,0.1); background: rgba(0, 0, 0, 0.1);
} }
} }
} }