mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Announcements for un registered users
This commit is contained in:
parent
ec8b64f494
commit
80bb95a76d
4 changed files with 44 additions and 8 deletions
|
@ -1,4 +1,8 @@
|
||||||
<div class="dashboard stretch-to-bottom">
|
<div class="dashboard stretch-to-bottom">
|
||||||
|
<section class="announce-wrapper" ng-class="announceWrapperClass">
|
||||||
|
<div id="announcement" ng-show="announcement != null" ng-class="announcementClass"></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="recent-tracks">
|
<section class="recent-tracks">
|
||||||
<h1>
|
<h1>
|
||||||
<a href="/tracks"><i class="fa fa-music"></i> see more</a>
|
<a href="/tracks"><i class="fa fa-music"></i> see more</a>
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
<p marked="announcement.text_content"></p>
|
<p marked="announcement.text_content"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="announce-actions">
|
<div class="announce-actions">
|
||||||
<span ng-repeat="link in announcement.links">
|
<a ng-repeat="link in announcement.links" ng-href="{{ ::link.url }}" target="_blank">{{ ::link.title }}</a>
|
||||||
<a ng-href="{{ ::link.url }}" target="_blank">{{ ::link.title }}</a>
|
|
||||||
</span>
|
|
||||||
<a href="#" ng-click="announcement.dontShowAgain()">Don't show again</a>
|
<a href="#" ng-click="announcement.dontShowAgain()">Don't show again</a>
|
||||||
</div>
|
</div>
|
||||||
<a href="#" class="dismiss-button" ng-click="announcement.dismiss()"><i class="fa fa-times"></i></a>
|
<a href="#" class="dismiss-button" ng-click="announcement.dismiss()"><i class="fa fa-times"></i></a>
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
<p marked="announcement.text_content"></p>
|
<p marked="announcement.text_content"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="announce-actions">
|
<div class="announce-actions">
|
||||||
<span ng-repeat="link in announcement.links">
|
<a ng-repeat="link in announcement.links" ng-href="{{ ::link.url }}" target="_blank">{{ ::link.title }}</a>
|
||||||
<a ng-href="{{ ::link.url }}" target="_blank">{{ ::link.title }}</a>
|
|
||||||
</span>
|
|
||||||
<a href="#" ng-click="announcement.dontShowAgain()">Don't show again</a>
|
<a href="#" ng-click="announcement.dontShowAgain()">Don't show again</a>
|
||||||
</div>
|
</div>
|
||||||
<a href="#" class="dismiss-button" ng-click="announcement.dismiss()"><i class="fa fa-times"></i></a>
|
<a href="#" class="dismiss-button" ng-click="announcement.dismiss()"><i class="fa fa-times"></i></a>
|
||||||
|
|
|
@ -20,14 +20,50 @@ window.pfm.preloaders['home'] = [
|
||||||
]
|
]
|
||||||
|
|
||||||
module.exports = angular.module('ponyfm').controller "home", [
|
module.exports = angular.module('ponyfm').controller "home", [
|
||||||
'$scope', 'meta', 'dashboard'
|
'$scope', 'meta', 'dashboard', '$http', 'announcements', '$compile'
|
||||||
($scope, meta, dashboard) ->
|
($scope, meta, dashboard, $http, announcements, $compile) ->
|
||||||
meta.reset()
|
meta.reset()
|
||||||
|
|
||||||
$scope.recentTracks = null
|
$scope.recentTracks = null
|
||||||
$scope.popularTracks = null
|
$scope.popularTracks = null
|
||||||
|
$scope.announcementClass = 'disabled'
|
||||||
|
$scope.announceWrapperClass = 'disabled'
|
||||||
|
|
||||||
|
$scope.loadAnnouncementTemplate = (url) ->
|
||||||
|
$http.get('/templates/' + url).success (templateContent) ->
|
||||||
|
compiledHtml = $compile(templateContent)($scope)
|
||||||
|
$('#announcement').append(compiledHtml)
|
||||||
|
|
||||||
dashboard.refresh().done (res) ->
|
dashboard.refresh().done (res) ->
|
||||||
$scope.recentTracks = res.recent_tracks
|
$scope.recentTracks = res.recent_tracks
|
||||||
$scope.popularTracks = res.popular_tracks
|
$scope.popularTracks = res.popular_tracks
|
||||||
|
|
||||||
|
announcements.refresh().done (ann) ->
|
||||||
|
$scope.announcement = ann
|
||||||
|
if $scope.announcement != null
|
||||||
|
if parseInt($.cookie('hide-announcement')) != parseInt($scope.announcement.id)
|
||||||
|
$scope.announcement.dismiss = () ->
|
||||||
|
$scope.announceWrapperClass = 'disabled'
|
||||||
|
|
||||||
|
$scope.announcement.dontShowAgain = () ->
|
||||||
|
$scope.announcement.dismiss()
|
||||||
|
$.cookie('hide-announcement', $scope.announcement.id)
|
||||||
|
|
||||||
|
switch $scope.announcement.announcement_type_id
|
||||||
|
when 1
|
||||||
|
$scope.announcementClass = "simple-announce " + $scope.announcement.css_class
|
||||||
|
$scope.announceWrapperClass = null
|
||||||
|
$scope.loadAnnouncementTemplate('partials/default-announcement.html')
|
||||||
|
when 2
|
||||||
|
$scope.announcementClass = "alert-announce " + $scope.announcement.css_class
|
||||||
|
$scope.announceWrapperClass = null
|
||||||
|
$scope.loadAnnouncementTemplate('partials/alert-announcement.html')
|
||||||
|
when 3
|
||||||
|
$scope.announcementClass = "serious-alert-announce " + $scope.announcement.css_class
|
||||||
|
$scope.announceWrapperClass = null
|
||||||
|
$scope.loadAnnouncementTemplate('partials/alert-announcement.html')
|
||||||
|
when 4
|
||||||
|
$scope.announcementClass = $scope.announcement.css_class
|
||||||
|
$scope.announceWrapperClass = null
|
||||||
|
$scope.loadAnnouncementTemplate($scope.announcement.template_url)
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue