Fix positioning of message-info-popover.

This commit is contained in:
hackerkid 2017-03-22 18:43:22 +05:30 committed by Tim Abbott
parent ed72ee476f
commit 97bd9d5186
1 changed files with 14 additions and 2 deletions

View File

@ -81,9 +81,21 @@ function show_message_info_popover(element, id) {
private_message_class: "respond_personal_button",
};
var ypos = elt.offset().top - message_viewport.scrollTop();
var ypos = elt.offset().top;
var popover_size = 418;
var placement = "right";
if (!((ypos + (popover_size / 2) < message_viewport.height()) &&
(ypos > (popover_size / 2)))) {
if (((ypos + popover_size) < message_viewport.height())) {
placement = "bottom";
} else if (ypos > popover_size) {
placement = "top";
}
}
elt.popover({
placement: (ypos > (message_viewport.height() - 300)) ? 'top' : 'bottom',
placement: placement,
template: templates.render('user_info_popover', {class: "message-info-popover"}),
title: templates.render('user_info_popover_title', {user_avatar: "avatar/" + sender_email}),
content: templates.render('user_info_popover_content', args),