mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05: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
|