-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[64112] Create an angular breadcrumb as placeholder for the toggle button #19229
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
base: dev
Are you sure you want to change the base?
[64112] Create an angular breadcrumb as placeholder for the toggle button #19229
Conversation
frontend/src/app/shared/components/breadcrumbs/op-breadcrumbs.component.ts
Fixed
Show fixed
Hide fixed
2f8bcfd
to
738c3a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall 👍 I have some code remarks and three styling related issues:
- On some pages it looks like on mobile, there is too much space between the breadcrumb and the headline

compared to the rails page

- The section headers of the sidebar are not reflected in the active breadcrumb element:

- The mobile BCF view is broken

if (this.isGantt) { | ||
items[1] = { | ||
href: this.pathHelperService.projectGanttChartsPath(this.currentProject.identifier as string), | ||
text: this.I18n.t('js.work_packages.gantt_charts_label'), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very hacky. Please assign the value conditionally instead overwriting it based on the index in the array.
if (this.isGantt) { | |
items[1] = { | |
href: this.pathHelperService.projectGanttChartsPath(this.currentProject.identifier as string), | |
text: this.I18n.t('js.work_packages.gantt_charts_label'), | |
}; | |
const items = [ | |
{ | |
href: this.pathHelperService.projectPath(this.currentProject.identifier as string), | |
text: this.currentProject.name, | |
}, | |
this.breadcrumbModuleEntry(); | |
this.selectedTitle ?? '', | |
]; | |
... | |
breadcrumbModuleEntry():{href: string, text:string} { | |
if (this.isGantt) { | |
return ... | |
} else { | |
return ... | |
} |
@@ -0,0 +1,40 @@ | |||
<div class="op-breadcrumbs"> | |||
<!-- Desktop Version --> | |||
<nav aria-label="breadcrumb" class="desktop"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The aria label needs to be internationalised
<ol class="breadcrumb"> | ||
<li | ||
class="breadcrumb-item" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
breadcrumb-item
is the same class as the Primer breadcrumb component is using while breadcrumb
seems to be new. I'd be very careful with re-using classes partially. At the top, you even have another namespace op-breadcrumbs
. Please do not mix things here and keep it under one op-...
namespace.
.desktop | ||
display: none | ||
.mobile | ||
display: block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have classes for this behavior hidden-for-mobile
and hidden-for-desktop
selector: 'op-breadcrumbs', | ||
styleUrls: ['./op-breadcrumbs.component.sass'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
encapsulation: ViewEncapsulation.None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the viewEncapsulation?
@@ -3,6 +3,7 @@ en: | |||
js: | |||
team_planner: | |||
add_existing: 'Add existing' | |||
team_planners_label: 'Team planners' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
team_planners_label: 'Team planners' | |
label_team_planner_plural: 'Team planners' |
@@ -151,6 +151,9 @@ | |||
|
|||
team_planner.title | |||
|
|||
expect(team_planner).to have_test_selector("breadcrumb-item", text: "Team planners") | |||
expect(team_planner).to have_css('.breadcrumb-item.active[aria-current="page"]', text: "Unnamed team planner") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See before
@@ -52,6 +52,9 @@ | |||
it do | |||
expect(page).to have_content("All open") | |||
|
|||
expect(page).to have_test_selector("breadcrumb-item", text: "Work packages") | |||
expect(page).to have_css('.breadcrumb-item.active[aria-current="page"]', text: "All open") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See before
</ng-container> | ||
|
||
<ng-container *ngIf="last"> | ||
<span>{{ isLink(item) ? item.text : item }}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> | ||
<ng-container *ngIf="!last"> | ||
<ng-container *ngIf="isLink(item); else plainText"> | ||
<a [href]="item.href">{{ item.text }}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the rails variant we set target
attributes on the link. Although, this is mostly relevant for Turbo, I'd like to set them here as well for consistency
Ticket
https://community.openproject.org/wp/64112
What are you trying to accomplish?
Create a breadcrumbs component for angular pages.
Screenshots
What approach did you choose and why?
Create the component and add it to partition query space component, and pass the items to it from other components that are using its template like boards, calendars, ...
Merge checklist