Fixed not removable items. Automatically shown online notification popover on new messages. Defined missing @header element.

This commit is contained in:
Martin Edenhofer 2016-03-20 21:41:19 +01:00
parent cc2a8ce0c1
commit 6953ae52af
2 changed files with 19 additions and 10 deletions

View file

@ -17,6 +17,7 @@ class App.OnlineNotificationWidget extends App.Controller
'.js-mark': 'mark'
'.js-item': 'item'
'.js-content': 'content'
'.js-header': 'header'
constructor: ->
super
@ -50,7 +51,7 @@ class App.OnlineNotificationWidget extends App.Controller
return
if @access()
@subscribeId = App.OnlineNotification.subscribe(@show)
@subscribeId = App.OnlineNotification.subscribe(@updateContent)
@bind('ui:reshow', =>
@show()
@ -59,6 +60,8 @@ class App.OnlineNotificationWidget extends App.Controller
$(window).on 'click.notifications', @hide
@updateContent()
release: ->
$(window).off 'click.notifications'
App.OnlineNotification.unsubscribe(@subscribeId)
@ -131,6 +134,7 @@ class App.OnlineNotificationWidget extends App.Controller
)
updateHeight: ->
# set height of notification popover
heightApp = $('#app').height()
heightPopoverSpacer = 22
@ -150,7 +154,7 @@ class App.OnlineNotificationWidget extends App.Controller
load = (data) =>
@fetchedData = true
App.OnlineNotification.refresh(data.stream, clear: true)
@show()
@updateContent()
App.OnlineNotification.fetchFull(load)
toggle: =>
@ -159,8 +163,7 @@ class App.OnlineNotificationWidget extends App.Controller
else
@show()
show: =>
@shown = true
updateContent: =>
if !@Session.get()
@content.html('')
return
@ -197,19 +200,25 @@ class App.OnlineNotificationWidget extends App.Controller
count: @count
)
return if !@shown
@show()
show: =>
@shown = true
@el.show()
@updateHeight()
hide: =>
@shown = false
@el.hide()
onItemClick: (event) ->
@locationVerify(event)
onItemClick: (e) ->
@locationVerify(e)
@hide()
removeItem: (event) ->
event.preventDefault()
event.stopPropagation()
removeItem: (e) =>
e.preventDefault()
e.stopPropagation()
row = $(e.target).closest('.js-item')
id = row.data('id')
App.OnlineNotification.destroy(id)