-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use pipe with map to generate menu entries
- Loading branch information
1 parent
29ed668
commit f9cee52
Showing
4 changed files
with
116 additions
and
122 deletions.
There are no files selected for viewing
150 changes: 74 additions & 76 deletions
150
frontend/src/app/components/objective/objective.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,80 @@ | ||
<div *ngIf="objective$ | async as objective"> | ||
<div | ||
(click)="openObjectiveDetail(objective.id)" | ||
(keydown.enter)="openObjectiveDetail(objective.id)" | ||
[attr.data-testId]="'objective'" | ||
class="objective rounded-3 bg-white w-100 cursor-pointer focus-outline" | ||
tabindex="0" | ||
> | ||
<div class="row mx-1"> | ||
<section class="d-flex mb-3 mt-3 justify-content-between pe-0"> | ||
<section class="d-flex gap-2 align-items-start fit-content objective-title"> | ||
<img | ||
(click)="$event.stopPropagation()" | ||
[attr.data-testId]="'objective-state'" | ||
[src]="'assets/icons/' + objective.state" | ||
alt="The objectives state" | ||
class="icon" | ||
matTooltip="{{ getStateTooltip() + ' ' + formatObjectiveState(objective.state) }}" | ||
matTooltipPosition="above" | ||
/> | ||
<h2 class="title fit-content">{{ objective.title }}</h2> | ||
</section> | ||
<button | ||
#menuButton | ||
*ngIf="isWritable" | ||
class="icon-button three-dot-menu focus-outline" | ||
[matMenuTriggerFor]="objectiveMenu" | ||
<div | ||
(click)="openObjectiveDetail(objective.id)" | ||
(keydown.enter)="openObjectiveDetail(objective.id)" | ||
*ngIf="objective$ | async as objective" | ||
[attr.data-testId]="'objective'" | ||
class="objective rounded-3 bg-white w-100 cursor-pointer focus-outline" | ||
tabindex="0" | ||
> | ||
<div class="row mx-1"> | ||
<section class="d-flex mb-3 mt-3 justify-content-between pe-0"> | ||
<section class="d-flex gap-2 align-items-start fit-content objective-title"> | ||
<img | ||
(click)="$event.stopPropagation()" | ||
(keydown.enter)="$event.stopPropagation()" | ||
[attr.data-testId]="'three-dot-menu'" | ||
> | ||
<img src="../assets/icons/three-dot-menu-icon.svg" alt="menu icon" class="text-white menu-scale" /> | ||
</button> | ||
[attr.data-testId]="'objective-state'" | ||
[src]="'assets/icons/' + objective.state" | ||
alt="The objectives state" | ||
class="icon" | ||
matTooltip="{{ getStateTooltip() + ' ' + formatObjectiveState(objective.state) }}" | ||
matTooltipPosition="above" | ||
/> | ||
<h2 class="title fit-content">{{ objective.title }}</h2> | ||
</section> | ||
<button | ||
*ngIf="isWritable" | ||
class="icon-button three-dot-menu focus-outline" | ||
[matMenuTriggerFor]="objectiveMenu" | ||
(click)="$event.stopPropagation()" | ||
(keydown.enter)="$event.stopPropagation()" | ||
[attr.data-testId]="'three-dot-menu'" | ||
> | ||
<img src="../assets/icons/three-dot-menu-icon.svg" alt="menu icon" class="text-white menu-scale" /> | ||
</button> | ||
</section> | ||
|
||
<div class="d-flex px-3 gap-3 flex-column"> | ||
<app-keyresult | ||
*ngFor="let keyResult of objective.keyResults; trackBy: trackByFn" | ||
class="border-0 p-0" | ||
(click)="$event.stopPropagation()" | ||
(keydown.enter)="$event.stopPropagation()" | ||
[keyResult]="keyResult" | ||
[attr.data-testId]="'keyresult'" | ||
></app-keyresult> | ||
</div> | ||
|
||
<section class="p-0 py-2 m-0"> | ||
<button | ||
*ngIf="!isObjectiveComplete(this.objective) && isWritable" | ||
mat-button | ||
color="primary" | ||
class="fw-bold px-0 pe-2 ms-2" | ||
[attr.data-testId]="'add-keyResult'" | ||
(click)="openAddKeyResultDialog(); $event.stopPropagation()" | ||
(keydown.enter)="$event.stopPropagation()" | ||
> | ||
<span class="d-flex align-items-center add-text"> | ||
<img alt="Add key-result button" class="add-cross-button" src="../../../assets/icons/new-icon.svg" /> | ||
Key Result hinzufügen | ||
</span> | ||
</button> | ||
</section> | ||
<div class="d-flex px-3 gap-3 flex-column"> | ||
<app-keyresult | ||
*ngFor="let keyResult of objective.keyResults; trackBy: trackByFn" | ||
class="border-0 p-0" | ||
(click)="$event.stopPropagation()" | ||
(keydown.enter)="$event.stopPropagation()" | ||
[keyResult]="keyResult" | ||
[attr.data-testId]="'keyresult'" | ||
></app-keyresult> | ||
</div> | ||
|
||
<section class="p-0 py-2 m-0"> | ||
<button | ||
*ngIf="!isObjectiveComplete(this.objective) && isWritable" | ||
mat-button | ||
color="primary" | ||
class="fw-bold px-0 pe-2 ms-2" | ||
[attr.data-testId]="'add-keyResult'" | ||
(click)="openAddKeyResultDialog(); $event.stopPropagation()" | ||
(keydown.enter)="$event.stopPropagation()" | ||
> | ||
<span class="d-flex align-items-center add-text"> | ||
<img alt="Add key-result button" class="add-cross-button" src="../../../assets/icons/new-icon.svg" /> | ||
Key Result hinzufügen | ||
</span> | ||
</button> | ||
</section> | ||
</div> | ||
<mat-menu | ||
#objectiveMenu="matMenu" | ||
[class]="'objective-three-dot-menu'" | ||
class="pt-2 pb-2" | ||
xPosition="before" | ||
yPosition="below" | ||
> | ||
<button | ||
(click)="$event.stopPropagation(); console.log('menuEntry', menuEntry)" | ||
*ngFor="let menuEntry of getMenu(objective)" | ||
[attr.data-testId]="'objective-menu'" | ||
class="objective-menu-option" | ||
mat-menu-item | ||
> | ||
{{ menuEntry.displayName }}123 | ||
</button> | ||
</mat-menu> | ||
</div> | ||
<mat-menu | ||
#objectiveMenu="matMenu" | ||
[class]="'objective-three-dot-menu'" | ||
class="pt-2 pb-2" | ||
xPosition="before" | ||
yPosition="below" | ||
> | ||
<button | ||
(click)="redirect(menuEntry)" | ||
*ngFor="let menuEntry of menuEntries | async" | ||
[attr.data-testId]="'objective-menu'" | ||
class="objective-menu-option" | ||
mat-menu-item | ||
> | ||
{{ menuEntry.displayName }} | ||
</button> | ||
</mat-menu> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters