mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
5a13ee1077
- don’t talk to postgres - show recent blog post announcments - proxy all events to analytics api
20 lines
615 B
CoffeeScript
20 lines
615 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.controller "AnnouncementsController", ($scope, $http, event_tracking, $window) ->
|
|
|
|
$scope.dataRecived = false
|
|
announcement = null
|
|
$http.get("/announcements").success (announcements) ->
|
|
if announcements?[0]?
|
|
announcement = announcements[0]
|
|
$scope.title = announcement.title
|
|
$scope.totalAnnouncements = announcements.length
|
|
$scope.dataRecived = true
|
|
|
|
dismissannouncement = ->
|
|
event_tracking.sendMB "announcement-alert-dismissed", {blogPostId:announcement.id}
|
|
|
|
$scope.openLink = ->
|
|
dismissannouncement()
|
|
$window.location.href = announcement.url
|