mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
HWC Winners announcement
This commit is contained in:
parent
b7088ccfb7
commit
7f566b266b
3 changed files with 64 additions and 4 deletions
26
public/templates/partials/announcements/hwc/winners.html
Normal file
26
public/templates/partials/announcements/hwc/winners.html
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<div class="announce-content">
|
||||||
|
<h2>{{ ::announcement.title }}</h2>
|
||||||
|
<p marked="announcement.text_content"></p>
|
||||||
|
</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}">
|
||||||
|
<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>
|
||||||
|
<i class="fa fa-pause" ng-if="track.isPlaying"></i>
|
||||||
|
</a>
|
||||||
|
<img pfm-src-loader="track.covers.thumbnail" pfm-src-size="thumbnail" />
|
||||||
|
</div>
|
||||||
|
<a class="info" ng-href="{{::track.url}}" ng-if="!hasOverride">
|
||||||
|
<span class="title">{{::track.title}}</span>
|
||||||
|
<span class="artist">{{::track.user.name}} / {{::track.genre.name}}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="announce-actions">
|
||||||
|
<a ng-repeat="link in announcement.links" ng-href="{{ ::link.url }}" target="_blank">{{ ::link.title }}</a>
|
||||||
|
<a href="#" ng-click="announcement.dontShowAgain()">Don't show again</a>
|
||||||
|
</div>
|
||||||
|
<a href="#" class="dismiss-button" ng-click="announcement.dismiss()"><i class="fa fa-times"></i></a>
|
|
@ -20,18 +20,29 @@ window.pfm.preloaders['dashboard'] = [
|
||||||
]
|
]
|
||||||
|
|
||||||
module.exports = angular.module('ponyfm').controller "dashboard", [
|
module.exports = angular.module('ponyfm').controller "dashboard", [
|
||||||
'$scope', 'dashboard', 'auth', '$http', 'announcements', '$compile'
|
'$scope', 'dashboard', 'auth', '$http', 'announcements', '$compile', 'tracks', 'player'
|
||||||
($scope, dashboard, auth, $http, announcements, $compile) ->
|
($scope, dashboard, auth, $http, announcements, $compile, tracks, player) ->
|
||||||
|
|
||||||
$scope.recentTracks = null
|
$scope.recentTracks = null
|
||||||
$scope.popularTracks = null
|
$scope.popularTracks = null
|
||||||
$scope.announcementClass = 'disabled'
|
$scope.announcementClass = 'disabled'
|
||||||
$scope.announceWrapperClass = 'disabled'
|
$scope.announceWrapperClass = 'disabled'
|
||||||
|
|
||||||
|
$scope.play = (track) ->
|
||||||
|
index = _.indexOf $scope.announcement.parsedTracks, (t) -> t.id == track.id
|
||||||
|
player.playTracks $scope.announcement.parsedTracks, index
|
||||||
|
|
||||||
$scope.loadAnnouncementTemplate = (url) ->
|
$scope.loadAnnouncementTemplate = (url) ->
|
||||||
$http.get('/templates/' + url).success (templateContent) ->
|
$http.get('/templates/' + url).success (templateContent) ->
|
||||||
compiledHtml = $compile(templateContent)($scope)
|
compiledHtml = $compile(templateContent)($scope)
|
||||||
$('#announcement').append(compiledHtml)
|
$('#announcement').append(compiledHtml)
|
||||||
|
if $scope.announcement.tracks.length > 0
|
||||||
|
console.log($scope.announcement.tracks)
|
||||||
|
$scope.announcement.parsedTracks = []
|
||||||
|
for track in $scope.announcement.tracks
|
||||||
|
tracks.fetch(track, false).done (trackResponse) ->
|
||||||
|
$scope.announcement.parsedTracks.push(trackResponse.track)
|
||||||
|
console.log(trackResponse)
|
||||||
|
|
||||||
dashboard.refresh().done (res) ->
|
dashboard.refresh().done (res) ->
|
||||||
$scope.recentTracks = res.recent_tracks
|
$scope.recentTracks = res.recent_tracks
|
||||||
|
|
27
resources/assets/styles/dashboard.less
vendored
27
resources/assets/styles/dashboard.less
vendored
|
@ -200,7 +200,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&.hwc-announce {
|
&.hwc-announce {
|
||||||
height: 150px;
|
height: 160px;
|
||||||
background-color: #68a1ee;
|
background-color: #68a1ee;
|
||||||
background-image: url(/images/hwc/hwc-announcement.jpg);
|
background-image: url(/images/hwc/hwc-announcement.jpg);
|
||||||
background-size: 300px;
|
background-size: 300px;
|
||||||
|
@ -216,13 +216,36 @@
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.announce-actions, .announce-content {
|
.announce-actions, .announce-content, .announce-tracks {
|
||||||
padding-left: 300px;
|
padding-left: 300px;
|
||||||
|
|
||||||
@media (max-width: 1200px) {
|
@media (max-width: 1200px) {
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.announce-tracks {
|
||||||
|
li {
|
||||||
|
width: 33%;
|
||||||
|
float: left;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.artist {
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-playing {
|
||||||
|
background: rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.secret-santa-announce {
|
&.secret-santa-announce {
|
||||||
|
|
Loading…
Reference in a new issue