diff --git a/public/templates/home/index.html b/public/templates/home/index.html
index f0dee43a..3b0ec10c 100644
--- a/public/templates/home/index.html
+++ b/public/templates/home/index.html
@@ -1,4 +1,8 @@
+
+
see more
diff --git a/public/templates/partials/alert-announcement.html b/public/templates/partials/alert-announcement.html
index a19801f1..9575bb83 100644
--- a/public/templates/partials/alert-announcement.html
+++ b/public/templates/partials/alert-announcement.html
@@ -3,9 +3,7 @@
diff --git a/public/templates/partials/default-announcement.html b/public/templates/partials/default-announcement.html
index e9934e78..b965dfd8 100644
--- a/public/templates/partials/default-announcement.html
+++ b/public/templates/partials/default-announcement.html
@@ -3,9 +3,7 @@
diff --git a/resources/assets/scripts/app/controllers/home.coffee b/resources/assets/scripts/app/controllers/home.coffee
index c375384f..187df7df 100644
--- a/resources/assets/scripts/app/controllers/home.coffee
+++ b/resources/assets/scripts/app/controllers/home.coffee
@@ -20,14 +20,50 @@ window.pfm.preloaders['home'] = [
]
module.exports = angular.module('ponyfm').controller "home", [
- '$scope', 'meta', 'dashboard'
- ($scope, meta, dashboard) ->
+ '$scope', 'meta', 'dashboard', '$http', 'announcements', '$compile'
+ ($scope, meta, dashboard, $http, announcements, $compile) ->
meta.reset()
$scope.recentTracks = 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) ->
$scope.recentTracks = res.recent_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)
]