Merge pull request #10890 from nextcloud/bugfix/10857/app-menu-resize
Fix app menu calculation for random size of the right header
This commit is contained in:
commit
b9783993da
|
@ -1562,13 +1562,14 @@ function initCore() {
|
||||||
|
|
||||||
var resizeMenu = function() {
|
var resizeMenu = function() {
|
||||||
var appList = $('#appmenu li');
|
var appList = $('#appmenu li');
|
||||||
var headerWidth = $('.header-left').outerWidth() - $('#nextcloud').outerWidth();
|
var rightHeaderWidth = $('.header-right').outerWidth();
|
||||||
|
var headerWidth = $('header').outerWidth();
|
||||||
var usePercentualAppMenuLimit = 0.33;
|
var usePercentualAppMenuLimit = 0.33;
|
||||||
var minAppsDesktop = 8;
|
var minAppsDesktop = 8;
|
||||||
var availableWidth = headerWidth - $(appList).width();
|
var availableWidth = headerWidth - $('#nextcloud').outerWidth() - (rightHeaderWidth > 210 ? rightHeaderWidth : 210)
|
||||||
var isMobile = $(window).width() < 768;
|
var isMobile = $(window).width() < 768;
|
||||||
if (!isMobile) {
|
if (!isMobile) {
|
||||||
availableWidth = headerWidth * usePercentualAppMenuLimit;
|
availableWidth = availableWidth * usePercentualAppMenuLimit;
|
||||||
}
|
}
|
||||||
var appCount = Math.floor((availableWidth / $(appList).width()));
|
var appCount = Math.floor((availableWidth / $(appList).width()));
|
||||||
if (isMobile && appCount > minAppsDesktop) {
|
if (isMobile && appCount > minAppsDesktop) {
|
||||||
|
@ -1613,7 +1614,7 @@ function initCore() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$(window).resize(resizeMenu);
|
$(window).resize(resizeMenu);
|
||||||
resizeMenu();
|
setTimeout(resizeMenu, 0);
|
||||||
|
|
||||||
// just add snapper for logged in users
|
// just add snapper for logged in users
|
||||||
if($('#app-navigation').length && !$('html').hasClass('lte9')) {
|
if($('#app-navigation').length && !$('html').hasClass('lte9')) {
|
||||||
|
|
|
@ -573,6 +573,10 @@ describe('Core base tests', function() {
|
||||||
});
|
});
|
||||||
it('Clicking menu toggle toggles navigation in', function() {
|
it('Clicking menu toggle toggles navigation in', function() {
|
||||||
window.initCore();
|
window.initCore();
|
||||||
|
// fore show more apps icon since otherwise it would be hidden since no icons are available
|
||||||
|
clock.tick(1 * 1000);
|
||||||
|
$('#more-apps').show();
|
||||||
|
|
||||||
expect($navigation.is(':visible')).toEqual(false);
|
expect($navigation.is(':visible')).toEqual(false);
|
||||||
$toggle.click();
|
$toggle.click();
|
||||||
clock.tick(1 * 1000);
|
clock.tick(1 * 1000);
|
||||||
|
|
Loading…
Reference in New Issue