mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
20 lines
549 B
CoffeeScript
20 lines
549 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.controller "AnnouncementsController", ($scope, $http, event_tracking, $window) ->
|
|
$scope.announcements = []
|
|
|
|
refreshAnnouncements = ->
|
|
$http.get("/announcements").success (announcements) ->
|
|
$scope.announcements = announcements
|
|
|
|
dismissCurrentAnnouncement = ->
|
|
event_tracking.sendMB "announcement-alert-dismissed", { blogPostId:announcement.id }
|
|
|
|
refreshAnnouncements()
|
|
|
|
$scope.openLink = ->
|
|
dismissCurrentAnnouncement()
|
|
.then(refreshAnnouncements)
|
|
|
|
$window.open = announcement.url
|