diff options
author | Simon L <szaimen@e.mail.de> | 2022-04-29 14:01:41 +0300 |
---|---|---|
committer | szaimen <szaimen@e.mail.de> | 2022-04-29 14:03:49 +0300 |
commit | 66e61be9ca3b6acfc18c72f65afe3f894b76d54e (patch) | |
tree | 5c1c954d9142baba9708520027fe93006b1a03a0 | |
parent | 8367b02785acd920db244ecb745517820ed9ff91 (diff) |
Revert "Show the child folders in the breadcrumb menu when on a parent entry."
Signed-off-by: szaimen <szaimen@e.mail.de>
-rw-r--r-- | apps/files/js/breadcrumb.js | 23 | ||||
-rw-r--r-- | apps/files/tests/js/breadcrumbSpec.js | 6 | ||||
-rw-r--r-- | core/css/styles.scss | 15 |
3 files changed, 13 insertions, 31 deletions
diff --git a/apps/files/js/breadcrumb.js b/apps/files/js/breadcrumb.js index 8a5d42bd975..383d3debd09 100644 --- a/apps/files/js/breadcrumb.js +++ b/apps/files/js/breadcrumb.js @@ -58,9 +58,7 @@ BreadCrumb.prototype = { $el: null, dir: null, - maxDepthDir: null, dirInfo: null, - activeItemIndex: 0, /** * Total width of all breadcrumbs @@ -83,9 +81,6 @@ dir = dir.replace(/\\/g, '/'); dir = dir || '/'; if (dir !== this.dir) { - if ((this.maxDepthDir || "").search(dir) !== 0) { - this.maxDepthDir = dir; - } this.dir = dir; this.render(); } @@ -123,7 +118,7 @@ // Menu is destroyed on every change, we need to init it OC.unregisterMenu($('.crumbmenu > .icon-more'), $('.crumbmenu > .popovermenu')); - var parts = this._makeCrumbs(this.maxDepthDir || '/'); + var parts = this._makeCrumbs(this.dir || '/'); var $crumb; var $menuItem; this.$el.empty(); @@ -168,7 +163,7 @@ if(menuPart.dir) { $menuItem = $('<li class="crumblist"><a><span class="icon-folder"></span><span></span></a></li>'); $menuItem.data('dir', menuPart.dir); - $menuItem.find('a').attr('href', this.getCrumbUrl(menuPart, j)); + $menuItem.find('a').attr('href', this.getCrumbUrl(part, j)); $menuItem.find('span:eq(1)').text(menuPart.name); this.$menu.children('ul').append($menuItem); if (this.onClick) { @@ -176,16 +171,11 @@ } } } - _.each(this._detailViews, function(view) { view.render({ dirInfo: this.dirInfo }); - - if (this.breadcrumbs.length > 2) { - this.breadcrumbs[this.activeItemIndex + 2].append(view.$el); - } - + $crumb.append(view.$el); $menuItem.append(view.$el.clone(true)); }, this); @@ -238,15 +228,8 @@ for (var i = 0; i < parts.length; i++) { var part = parts[i]; pathToHere = pathToHere + '/' + part; - - let classes = ""; - if (pathToHere === this.dir) { - this.activeItemIndex = i; - classes = "active"; - } crumbs.push({ dir: pathToHere, - class: classes, name: part }); } diff --git a/apps/files/tests/js/breadcrumbSpec.js b/apps/files/tests/js/breadcrumbSpec.js index b83ec78be7b..820b0f70569 100644 --- a/apps/files/tests/js/breadcrumbSpec.js +++ b/apps/files/tests/js/breadcrumbSpec.js @@ -56,15 +56,13 @@ describe('OCA.Files.BreadCrumb tests', function() { expect($crumbs.eq(1).find('a').hasClass('icon-home')).toEqual(true); expect($crumbs.eq(1).data('dir')).toEqual('/'); }); - it('Renders complete directory when switching to root', function() { + it('Renders root when switching to root', function() { var $crumbs; bc.setDirectory('/somedir'); bc.setDirectory('/'); $crumbs = bc.$el.find('.crumb'); - expect($crumbs.length).toEqual(3); + expect($crumbs.length).toEqual(2); expect($crumbs.eq(1).data('dir')).toEqual('/'); - expect($crumbs.eq(2).data('dir')).toEqual('/somedir'); - expect($crumbs.eq(2).attr('class').includes("active")).toEqual(false); }); it('Renders single path section', function() { var $crumbs; diff --git a/core/css/styles.scss b/core/css/styles.scss index 27e5675b53a..f0c33a2037d 100644 --- a/core/css/styles.scss +++ b/core/css/styles.scss @@ -1182,13 +1182,6 @@ div.crumb { order: 3; } } - &.active { - font-weight: bold; - // Allow multiple span next to the main 'a' - a ~ span { - padding-left: 0; - } - } > a, > span { position: relative; @@ -1213,6 +1206,14 @@ div.crumb { } &:not(:first-child) a { } + &:last-child { + font-weight: bold; + margin-right: 10px; + // Allow multiple span next to the main 'a' + a ~ span { + padding-left: 0; + } + } &:hover, &:focus, a:focus, &:active { opacity: 1; |