Skip to content

Commit 8614f1c

Browse files
authored
Revert "Show the child folders in the breadcrumb menu when on a parent entry."
1 parent 8367b02 commit 8614f1c

File tree

3 files changed

+13
-31
lines changed

3 files changed

+13
-31
lines changed

apps/files/js/breadcrumb.js

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@
5858
BreadCrumb.prototype = {
5959
$el: null,
6060
dir: null,
61-
maxDepthDir: null,
6261
dirInfo: null,
63-
activeItemIndex: 0,
6462

6563
/**
6664
* Total width of all breadcrumbs
@@ -83,9 +81,6 @@
8381
dir = dir.replace(/\\/g, '/');
8482
dir = dir || '/';
8583
if (dir !== this.dir) {
86-
if ((this.maxDepthDir || "").search(dir) !== 0) {
87-
this.maxDepthDir = dir;
88-
}
8984
this.dir = dir;
9085
this.render();
9186
}
@@ -123,7 +118,7 @@
123118
// Menu is destroyed on every change, we need to init it
124119
OC.unregisterMenu($('.crumbmenu > .icon-more'), $('.crumbmenu > .popovermenu'));
125120

126-
var parts = this._makeCrumbs(this.maxDepthDir || '/');
121+
var parts = this._makeCrumbs(this.dir || '/');
127122
var $crumb;
128123
var $menuItem;
129124
this.$el.empty();
@@ -168,24 +163,19 @@
168163
if(menuPart.dir) {
169164
$menuItem = $('<li class="crumblist"><a><span class="icon-folder"></span><span></span></a></li>');
170165
$menuItem.data('dir', menuPart.dir);
171-
$menuItem.find('a').attr('href', this.getCrumbUrl(menuPart, j));
166+
$menuItem.find('a').attr('href', this.getCrumbUrl(part, j));
172167
$menuItem.find('span:eq(1)').text(menuPart.name);
173168
this.$menu.children('ul').append($menuItem);
174169
if (this.onClick) {
175170
$menuItem.on('click', this.onClick);
176171
}
177172
}
178173
}
179-
180174
_.each(this._detailViews, function(view) {
181175
view.render({
182176
dirInfo: this.dirInfo
183177
});
184-
185-
if (this.breadcrumbs.length > 2) {
186-
this.breadcrumbs[this.activeItemIndex + 2].append(view.$el);
187-
}
188-
178+
$crumb.append(view.$el);
189179
$menuItem.append(view.$el.clone(true));
190180
}, this);
191181

@@ -238,15 +228,8 @@
238228
for (var i = 0; i < parts.length; i++) {
239229
var part = parts[i];
240230
pathToHere = pathToHere + '/' + part;
241-
242-
let classes = "";
243-
if (pathToHere === this.dir) {
244-
this.activeItemIndex = i;
245-
classes = "active";
246-
}
247231
crumbs.push({
248232
dir: pathToHere,
249-
class: classes,
250233
name: part
251234
});
252235
}

apps/files/tests/js/breadcrumbSpec.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,13 @@ describe('OCA.Files.BreadCrumb tests', function() {
5656
expect($crumbs.eq(1).find('a').hasClass('icon-home')).toEqual(true);
5757
expect($crumbs.eq(1).data('dir')).toEqual('/');
5858
});
59-
it('Renders complete directory when switching to root', function() {
59+
it('Renders root when switching to root', function() {
6060
var $crumbs;
6161
bc.setDirectory('/somedir');
6262
bc.setDirectory('/');
6363
$crumbs = bc.$el.find('.crumb');
64-
expect($crumbs.length).toEqual(3);
64+
expect($crumbs.length).toEqual(2);
6565
expect($crumbs.eq(1).data('dir')).toEqual('/');
66-
expect($crumbs.eq(2).data('dir')).toEqual('/somedir');
67-
expect($crumbs.eq(2).attr('class').includes("active")).toEqual(false);
6866
});
6967
it('Renders single path section', function() {
7068
var $crumbs;

core/css/styles.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,13 +1182,6 @@ div.crumb {
11821182
order: 3;
11831183
}
11841184
}
1185-
&.active {
1186-
font-weight: bold;
1187-
// Allow multiple span next to the main 'a'
1188-
a ~ span {
1189-
padding-left: 0;
1190-
}
1191-
}
11921185
> a,
11931186
> span {
11941187
position: relative;
@@ -1213,6 +1206,14 @@ div.crumb {
12131206
}
12141207
&:not(:first-child) a {
12151208
}
1209+
&:last-child {
1210+
font-weight: bold;
1211+
margin-right: 10px;
1212+
// Allow multiple span next to the main 'a'
1213+
a ~ span {
1214+
padding-left: 0;
1215+
}
1216+
}
12161217
&:hover, &:focus, a:focus, &:active {
12171218
opacity: 1;
12181219

0 commit comments

Comments
 (0)