Fix menu declaration and width calculation

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2017-11-10 08:23:24 +01:00
parent ebf131be84
commit f40e56f0e6
No known key found for this signature in database
GPG Key ID: FB5ACEED51955BF8
1 changed files with 6 additions and 4 deletions

View File

@ -114,8 +114,8 @@
* Renders the breadcrumb elements * Renders the breadcrumb elements
*/ */
render: function() { render: function() {
// Hide menu on render // Menu is destroyed on every change, we need to init it
OC.hideMenus(); OC.unregisterMenu($('.crumbmenu'), $('.crumbmenu > .popovermenu'));
var parts = this._makeCrumbs(this.dir || '/'); var parts = this._makeCrumbs(this.dir || '/');
var $crumb; var $crumb;
@ -193,8 +193,10 @@
greedy: true greedy: true
}); });
} }
// Menu is destroyed on every change, we need to init it // Menu is destroyed on every change, we need to init it
OC.registerMenu($('.crumbmenu'), $('.crumbmenu > .popovermenu')); OC.registerMenu($('.crumbmenu'), $('.crumbmenu > .popovermenu'));
this._resize(); this._resize();
}, },
@ -329,7 +331,7 @@
// Used for testing since this.$el.parent fails // Used for testing since this.$el.parent fails
if (!this.availableWidth) { 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 { } else {
this.usedWidth = this.availableWidth; this.usedWidth = this.availableWidth;
} }
@ -337,7 +339,7 @@
// If container is smaller than content // If container is smaller than content
// AND if there are crumbs left to hide // AND if there are crumbs left to hide
while (this.getTotalWidth() > this.usedWidth while (this.getTotalWidth() > this.usedWidth
&& this.$el.find(this.crumbSelector).length > 0) { && this.$el.find(this.crumbSelector).length > 0) {
this._hideCrumb(); this._hideCrumb();
} }
// If container is bigger than content + element to be shown // If container is bigger than content + element to be shown