Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the filebrowser home icon to a folder #6553

Merged
merged 3 commits into from Jun 13, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/filebrowser/src/crumbs.ts
Expand Up @@ -30,9 +30,9 @@ const MATERIAL_CLASS = 'jp-MaterialIcon';
const BREADCRUMB_CLASS = 'jp-BreadCrumbs';

/**
* The class name added to add the home icon for the breadcrumbs
* The class name added to add the folder icon for the breadcrumbs
*/
const BREADCRUMB_HOME = 'jp-HomeIcon';
const BREADCRUMB_HOME = 'jp-FolderIcon';

/**
* The class named associated to the ellipses icon
Expand Down Expand Up @@ -323,27 +323,28 @@ namespace Private {
while (firstChild && firstChild.nextSibling) {
node.removeChild(firstChild.nextSibling);
}
node.appendChild(separators[0]);

let parts = path.split('/');
if (parts.length > 2) {
node.appendChild(separators[0]);
node.appendChild(breadcrumbs[Crumb.Ellipsis]);
let grandParent = parts.slice(0, parts.length - 2).join('/');
breadcrumbs[Crumb.Ellipsis].title = grandParent;
node.appendChild(separators[1]);
}

if (path) {
if (parts.length >= 2) {
node.appendChild(separators[1]);
breadcrumbs[Crumb.Parent].textContent = parts[parts.length - 2];
node.appendChild(breadcrumbs[Crumb.Parent]);
let parent = parts.slice(0, parts.length - 1).join('/');
breadcrumbs[Crumb.Parent].title = parent;
node.appendChild(separators[2]);
}
node.appendChild(separators[2]);
breadcrumbs[Crumb.Current].textContent = parts[parts.length - 1];
node.appendChild(breadcrumbs[Crumb.Current]);
breadcrumbs[Crumb.Current].title = path;
node.appendChild(separators[3]);
}
}

Expand All @@ -352,9 +353,8 @@ namespace Private {
*/
export function createCrumbs(): ReadonlyArray<HTMLElement> {
let home = document.createElement('span');
home.className =
MATERIAL_CLASS + ' ' + BREADCRUMB_HOME + ' ' + BREADCRUMB_ITEM_CLASS;
home.title = PageConfig.getOption('serverRoot') || 'Home';
home.className = `${MATERIAL_CLASS} ${BREADCRUMB_HOME} ${BREADCRUMB_ITEM_CLASS}`;
home.title = PageConfig.getOption('serverRoot') || 'Jupyter Server Root';
jasongrout marked this conversation as resolved.
Show resolved Hide resolved
let ellipsis = document.createElement('span');
ellipsis.className =
MATERIAL_CLASS + ' ' + BREADCRUMB_ELLIPSES + ' ' + BREADCRUMB_ITEM_CLASS;
Expand All @@ -370,9 +370,9 @@ namespace Private {
*/
export function createCrumbSeparators(): ReadonlyArray<HTMLElement> {
let items: HTMLElement[] = [];
for (let i = 0; i < 3; i++) {
let item = document.createElement('i');
item.className = 'fa fa-angle-right';
jasongrout marked this conversation as resolved.
Show resolved Hide resolved
for (let i = 0; i < 4; i++) {
jasongrout marked this conversation as resolved.
Show resolved Hide resolved
let item = document.createElement('span');
item.textContent = '/';
items.push(item);
}
return items;
Expand Down