Fixed keyboard navigation and min. height with empty online notification.

This commit is contained in:
Martin Edenhofer 2016-03-21 16:48:43 +01:00
parent cc12b91961
commit 121bf3c271

View file

@ -10,7 +10,6 @@ class App.OnlineNotificationWidget extends App.Controller
'click .js-item': 'hide' 'click .js-item': 'hide'
'click .js-remove': 'removeItem' 'click .js-remove': 'removeItem'
'click .js-locationVerify': 'onItemClick' 'click .js-locationVerify': 'onItemClick'
'keydown': 'listNavigate'
elements: elements:
'.js-mark': 'mark' '.js-mark': 'mark'
@ -58,11 +57,13 @@ class App.OnlineNotificationWidget extends App.Controller
) )
$(window).on 'click.notifications', @hide $(window).on 'click.notifications', @hide
$(window).on 'keydown.notifications', @listNavigate
@updateContent() @updateContent()
release: -> release: ->
$(window).off 'click.notifications' $(window).off 'click.notifications'
$(window).off 'keydown.notifications'
App.OnlineNotification.unsubscribe(@subscribeId) App.OnlineNotification.unsubscribe(@subscribeId)
super super
@ -99,7 +100,7 @@ class App.OnlineNotificationWidget extends App.Controller
current.removeClass('is-hover') current.removeClass('is-hover')
next.addClass('is-hover') next.addClass('is-hover')
else else
prev = current.prev('.is-item') prev = current.prev('.js-item')
if prev.size() if prev.size()
current.removeClass('is-hover') current.removeClass('is-hover')
prev.addClass('is-hover') prev.addClass('is-hover')
@ -138,7 +139,7 @@ class App.OnlineNotificationWidget extends App.Controller
heightApp = $('#app').height() heightApp = $('#app').height()
heightPopoverSpacer = 22 heightPopoverSpacer = 22
heightPopoverHeader = @header.outerHeight(true) heightPopoverHeader = @header.outerHeight(true)
heightPopoverContent = 0 heightPopoverContent = 30
@item.each -> heightPopoverContent += @clientHeight @item.each -> heightPopoverContent += @clientHeight
if (heightPopoverHeader + heightPopoverContent + heightPopoverSpacer) > heightApp if (heightPopoverHeader + heightPopoverContent + heightPopoverSpacer) > heightApp