Merge pull request #212 from okriuchykhin/ok_SCI_530

Fixes issue with comments options menu [SCI-530]
This commit is contained in:
okriuchykhin 2016-10-13 13:13:41 +02:00 committed by GitHub
commit 9a3e531b33
2 changed files with 8 additions and 4 deletions

View file

@ -165,7 +165,7 @@ var Comments = (function() {
}
function initCommentOptions(scrollableContainer, useParentOffset) {
if ( ! _.isUndefined(typeof useParentOffset) ) {
if ( ! _.isUndefined(useParentOffset) ) {
useParentOffset = useParentOffset;
} else {
useParentOffset = true;
@ -179,8 +179,10 @@ var Comments = (function() {
var $el = $(this);
var menu = $el.find('.dropdown-menu');
var leftPos = $el.offset().left;
var parentTopPos = $el.offset().top;
if (leftPos + menu.width() > $(window).width()) {
menu.offset({ left: leftPos - menu.width() });
menu.offset({ left: leftPos - menu.width(),
top: (parentTopPos + <%= DROPDOWN_TOP_OFFSET %>)});
}
});
}
@ -197,7 +199,7 @@ var Comments = (function() {
}
function scrollCommentOptions(selector, useParentOffset) {
if ( ! _.isUndefined(typeof useParentOffset) ) {
if ( ! _.isUndefined(useParentOffset) ) {
useParentOffset = useParentOffset;
} else {
useParentOffset = true;
@ -206,7 +208,7 @@ var Comments = (function() {
var $el = $(el);
var offset = useParentOffset ? $el.offset().top : $el.position().top;
$el.find('.dropdown-menu-fixed')
.offset({ top: (offset + 20) });
.offset({ top: (offset + <%= DROPDOWN_TOP_OFFSET %>) });
});
}

View file

@ -40,6 +40,8 @@ FILE_MAX_SIZE = 50
AVATAR_MAX_SIZE = 0.2
# Max characters for text in dropdown list
DROPDOWN_TEXT_MAX_LENGTH = 15
# Dropdown top offset from the parent
DROPDOWN_TOP_OFFSET = 20
SEARCH_LIMIT = 20