From f40e56f0e645cfb36ed39decdba7d4a215ed986c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Fri, 10 Nov 2017 08:23:24 +0100 Subject: [PATCH] Fix menu declaration and width calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files/js/breadcrumb.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/files/js/breadcrumb.js b/apps/files/js/breadcrumb.js index 44dccf95b7..35aeb8d357 100644 --- a/apps/files/js/breadcrumb.js +++ b/apps/files/js/breadcrumb.js @@ -114,8 +114,8 @@ * Renders the breadcrumb elements */ render: function() { - // Hide menu on render - OC.hideMenus(); + // Menu is destroyed on every change, we need to init it + OC.unregisterMenu($('.crumbmenu'), $('.crumbmenu > .popovermenu')); var parts = this._makeCrumbs(this.dir || '/'); var $crumb; @@ -193,8 +193,10 @@ greedy: true }); } + // Menu is destroyed on every change, we need to init it OC.registerMenu($('.crumbmenu'), $('.crumbmenu > .popovermenu')); + this._resize(); }, @@ -329,7 +331,7 @@ // Used for testing since this.$el.parent fails if (!this.availableWidth) { - this.usedWidth = this.$el.parent().width() - this.$el.next('.actions').width(); + this.usedWidth = this.$el.parent().width() - (this.$el.parent().find('.button').length + 1) * 44; } else { this.usedWidth = this.availableWidth; } @@ -337,7 +339,7 @@ // If container is smaller than content // AND if there are crumbs left to hide while (this.getTotalWidth() > this.usedWidth - && this.$el.find(this.crumbSelector).length > 0) { + && this.$el.find(this.crumbSelector).length > 0) { this._hideCrumb(); } // If container is bigger than content + element to be shown