2016-11-11 12:03:01 -05:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.controller "AnnouncementsController", ($scope, $http, event_tracking, $window) ->
|
2016-11-29 12:12:53 -05:00
|
|
|
$scope.announcements = []
|
2016-11-11 12:03:01 -05:00
|
|
|
|
2016-11-29 12:12:53 -05:00
|
|
|
refreshAnnouncements = ->
|
|
|
|
$http.get("/announcements").success (announcements) ->
|
|
|
|
$scope.announcements = announcements
|
|
|
|
|
|
|
|
dismissCurrentAnnouncement = ->
|
|
|
|
event_tracking.sendMB "announcement-alert-dismissed", { blogPostId:announcement.id }
|
2016-11-11 12:03:01 -05:00
|
|
|
|
2016-11-29 12:12:53 -05:00
|
|
|
refreshAnnouncements()
|
2016-11-11 12:03:01 -05:00
|
|
|
|
|
|
|
$scope.openLink = ->
|
2016-11-29 12:12:53 -05:00
|
|
|
dismissCurrentAnnouncement()
|
|
|
|
.then(refreshAnnouncements)
|
|
|
|
|
|
|
|
$window.open = announcement.url
|