summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-06-14 11:36:04 -0500
committerGitHub <noreply@github.com>2017-06-14 11:36:04 -0500
commitfc47d0bbaa0e80fa073d091cb5b0db4b8612a4e3 (patch)
tree715669df6001b0336bb400391d06478432c69e57 /core
parent8eb955d5c6f77d93f2e0cb38e1795d79e4ec2782 (diff)
parentcec2893d3bd35ef0a99ec832c241e7a516f5da14 (diff)
downloadnextcloud-server-fc47d0bbaa0e80fa073d091cb5b0db4b8612a4e3.tar.gz
nextcloud-server-fc47d0bbaa0e80fa073d091cb5b0db4b8612a4e3.zip
Merge pull request #5244 from nextcloud/dynamic-percentual-appmenu-limit
Now using dynamic percentual appmenu limit
Diffstat (limited to 'core')
-rw-r--r--core/js/js.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js
index ee4b03dd99d..2aa7bf1bc55 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1512,12 +1512,30 @@ function initCore() {
var resizeMenu = function() {
var appList = $('#appmenu li');
- var availableWidth = $('#header-left').width() - $('#nextcloud').width() - 44;
- var appCount = Math.floor((availableWidth)/44);
+ var headerWidth = $('#header-left').width() - $('#nextcloud').width()
+ var usePercentualAppMenuLimit = 0.33;
+ var minAppsDesktop = 8;
+ var availableWidth = headerWidth - $(appList).width();
+ var isMobile = $(window).width() < 768;
+ if (!isMobile) {
+ availableWidth = headerWidth * usePercentualAppMenuLimit;
+ }
+ var appCount = Math.floor((availableWidth / $(appList).width()));
+ if (isMobile && appCount > minAppsDesktop) {
+ appCount = minAppsDesktop;
+ }
+ if (!isMobile && appCount < minAppsDesktop) {
+ appCount = minAppsDesktop;
+ }
+
// show at least 2 apps in the popover
if(appList.length-1-appCount >= 1) {
appCount--;
}
+ // show at least one icon
+ if(appCount < 1) {
+ appCount = 1;
+ }
$('#more-apps a').removeClass('active');
var lastShownApp;