From 59007035ed1e01cbba5f84bbe7325a362d1fe3fe Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 16 Apr 2019 13:36:32 -0400 Subject: [PATCH] Correctly size UI dialog accounting for height of menubar --- js/Common.js | 3 +++ js/crm.ajax.js | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/Common.js b/js/Common.js index e2714c33b0..1dee5a526a 100644 --- a/js/Common.js +++ b/js/Common.js @@ -944,6 +944,9 @@ if (!CRM.vars) CRM.vars = {}; $(this).button('option', 'icons', {primary: 'fa-expand'}); } else { var menuHeight = $('#civicrm-menu').outerHeight(); + if ($('body').hasClass('crm-menubar-below-cms-menu')) { + menuHeight += $('#civicrm-menu').offset().top; + } $el.data('origSize', { position: {my: 'center', at: 'center center+' + (menuHeight / 2), of: window}, width: $el.dialog('option', 'width'), diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 5a1155c846..23be078e8b 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -572,8 +572,11 @@ var currentHeight = $wrapper.outerHeight(), padding = currentHeight - $dialog.height(), newHeight = $dialog.prop('scrollHeight') + padding, - menuHeight = $('#civicrm-menu').outerHeight(), - maxHeight = $(window).height() - menuHeight; + menuHeight = $('#civicrm-menu').outerHeight(); + if ($('body').hasClass('crm-menubar-below-cms-menu')) { + menuHeight += $('#civicrm-menu').offset().top; + } + var maxHeight = $(window).height() - menuHeight; newHeight = newHeight > maxHeight ? maxHeight : newHeight; if (newHeight > (currentHeight + 15)) { $dialog.dialog('option', { -- 2.25.1