Improved positioning of notification popover (way done in controller and css with unmodified BS popover.js).

This commit is contained in:
Martin Edenhofer 2015-01-21 17:20:34 +01:00
parent f55b6c76c7
commit 0404fe31ae
2 changed files with 21 additions and 14 deletions

View file

@ -64,17 +64,19 @@ class App.OnlineNotificationWidget extends App.Controller
onShow: => onShow: =>
@updateContent() @updateContent()
# set heigth of notification popover # set height of notification popover
heightApp = $('#navigation').height() notificationsContainer = $('.js-notificationsContainer')
heightPopoverHeader = $('.js-notificationsContainer .popover-notificationsHeader').height() heightApp = $('#app').height()
heightPopoverContent = $('.js-notificationsContainer .popover-content').get(0).scrollHeight heightPopoverSpacer = 36
height = heightPopoverHeader + heightPopoverContent heightPopoverHeader = notificationsContainer.find('.popover-notificationsHeader').outerHeight()
if height > heightApp heightPopoverContent = notificationsContainer.find('.popover-content').get(0).scrollHeight
height = heightApp - heightPopoverHeader - 56 heightPopoverContentNew = heightPopoverContent
$('.js-notificationsContainer .popover-content').css('height', "#{height}px") if (heightPopoverHeader + heightPopoverContent + heightPopoverSpacer) > heightApp
heightPopoverContentNew = heightApp - heightPopoverHeader - heightPopoverSpacer
# set popover arrow notificationsContainer.addClass('is-overflowing')
$('.js-notificationsContainer .arrow').css('top', '20px') else
notificationsContainer.removeClass('is-overflowing')
notificationsContainer.find('.popover-content').css('height', "#{heightPopoverContentNew}px")
# close notification list on click # close notification list on click
$('.js-notificationsContainer').on('click', (e) => $('.js-notificationsContainer').on('click', (e) =>

View file

@ -2710,12 +2710,17 @@ footer {
} }
.popover--notifications { .popover--notifications {
min-height: 100px;
@extend .zIndex-5; @extend .zIndex-5;
&.is-visible { &.is-visible {
@extend .vertical; @extend .vertical;
} }
.arrow {
top: 23px !important;
}
.popover-content { .popover-content {
@extend .flex; @extend .flex;
} }