diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-08-27 18:03:42 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-11-13 15:52:15 +0100 |
commit | a5fbbe2b0bfaa88004e7541144469af84453e235 (patch) | |
tree | e6f86fbd285791f763c987864f95f935e2a711c7 | |
parent | fb559ed05e25a40536eeecd0c1d986eb9513764b (diff) | |
download | nextcloud-server-a5fbbe2b0bfaa88004e7541144469af84453e235.tar.gz nextcloud-server-a5fbbe2b0bfaa88004e7541144469af84453e235.zip |
Fix app menu calculation for random size of the right header
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | core/js/js.js | 9 | ||||
-rw-r--r-- | core/js/tests/specs/coreSpec.js | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/core/js/js.js b/core/js/js.js index 71c26dac01a..8d79311002e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1573,13 +1573,14 @@ function initCore() { var resizeMenu = function() { 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 minAppsDesktop = 8; - var availableWidth = headerWidth - $(appList).width(); + var availableWidth = headerWidth - $('#nextcloud').outerWidth() - (rightHeaderWidth > 210 ? rightHeaderWidth : 210) var isMobile = $(window).width() < 768; if (!isMobile) { - availableWidth = headerWidth * usePercentualAppMenuLimit; + availableWidth = availableWidth * usePercentualAppMenuLimit; } var appCount = Math.floor((availableWidth / $(appList).width())); if (isMobile && appCount > minAppsDesktop) { @@ -1624,7 +1625,7 @@ function initCore() { } }; $(window).resize(resizeMenu); - resizeMenu(); + setTimeout(resizeMenu, 0); // just add snapper for logged in users if($('#app-navigation').length && !$('html').hasClass('lte9')) { diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index 6766fc2789c..575b4c34ba3 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -550,6 +550,10 @@ describe('Core base tests', function() { }); it('Clicking menu toggle toggles navigation in', function() { 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); $toggle.click(); clock.tick(1 * 1000); |