mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 09:38:18 +00:00
Update notification beacon on realtime push
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
notificationCount: "#notification-count"
|
||||
|
||||
initialize: =>
|
||||
@listenTo App.vent, "model:notification:new", @initialize
|
||||
#quick and dirty check to see if user is logged in
|
||||
@collection = new App.NotificationApp.Models.NotificationCollection
|
||||
@collection.fetch(
|
||||
@@ -35,6 +36,7 @@
|
||||
$(@ui.notificationCount).text(newCount + " new notifications")
|
||||
$(@ui.notificationCountBadge).show()
|
||||
$(@ui.notificationCountBadge).addClass('animate pulse')
|
||||
console.log("Animating bell")
|
||||
$('#notification-icon', @el).addClass('icon-animated-bell')
|
||||
|
||||
$(@ui.notificationCountBadge).text(newCount)
|
||||
|
||||
@@ -8,25 +8,10 @@
|
||||
@socket.on "connect", ->
|
||||
console.log("RealtimeController: Socket connected")
|
||||
|
||||
@socket.on "message", (message) ->
|
||||
alert(message)
|
||||
|
||||
@socket.on "server-session", (session) =>
|
||||
if session
|
||||
console.log("RealtimeController: Connected " + sessionId)
|
||||
sessionId = session['sessionId']
|
||||
@registerSessionWithServer sessionId
|
||||
else
|
||||
console.log("RealtimeController: Can't read sessionId from socket")
|
||||
|
||||
@socket.on "activity", (data) =>
|
||||
console.log("RealtimeController: activity " + data['message'])
|
||||
utils.showMessage("New activity", data['message'])
|
||||
vent.trigger("model:activity:new", data['message'])
|
||||
|
||||
@socket.on "notification", (data) =>
|
||||
console.log("RealtimeController: notification " + data['message'])
|
||||
vent.trigger("model:notification:new", data['message'])
|
||||
utils.showMessage("New activity", data['message'])
|
||||
App.vent.trigger("model:notification:new", data['message'])
|
||||
else
|
||||
console.log("Realtime server unavailable")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user