Skip to content

Commit

Permalink
Merge pull request #1182 from DSD-DBS/link-behavior-fix
Browse files Browse the repository at this point in the history
fix: Enable default link behaviors on nav bar and side nav links
  • Loading branch information
MoritzWeber0 authored Nov 10, 2023
2 parents 028853a + 9cd086a commit 37d6244
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 27 deletions.
32 changes: 19 additions & 13 deletions frontend/src/app/general/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,25 @@
</div>

<div class="hidden gap-2 xl:flex">
<div
*ngFor="let item of navBarService.navBarItems"
[routerLink]="item.routerLink"
>
<a
mat-raised-button
color="primary"
*ngIf="userService.validateUserRole(item.requiredRole)"
[attr.href]="item.href"
[attr.target]="item.target"
>
{{ item.name }} <mat-icon *ngIf="item.icon">{{ item.icon }}</mat-icon>
</a>
<div *ngFor="let item of navBarService.navBarItems">
<ng-container *ngIf="userService.validateUserRole(item.requiredRole)">
<ng-container *ngIf="item.href; else router">
<a
mat-raised-button
color="primary"
[attr.href]="item.href"
[attr.target]="item.target"
>
{{ item.name }}
<mat-icon *ngIf="item.icon">{{ item.icon }}</mat-icon>
</a>
</ng-container>
<ng-template #router>
<a mat-raised-button color="primary" [routerLink]="item.routerLink">
{{ item.name }}
</a>
</ng-template>
</ng-container>
</div>
</div>
<div>
Expand Down
38 changes: 24 additions & 14 deletions frontend/src/app/general/nav-bar-menu/nav-bar-menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,30 @@

<mat-list>
<div *ngFor="let item of navBarService.navBarItems">
<div [routerLink]="item.routerLink">
<a
mat-list-item
(click)="navBarService.toggle()"
*ngIf="userService.validateUserRole(item.requiredRole)"
[attr.href]="item.href"
[attr.target]="item.target"
>
{{ item.name }}
<mat-icon class="open-in-new" *ngIf="item.icon">{{
item.icon
}}</mat-icon>
</a>
</div>
<ng-container *ngIf="userService.validateUserRole(item.requiredRole)">
<ng-container *ngIf="item.href; else router">
<a
mat-list-item
(click)="navBarService.toggle()"
[attr.href]="item.href"
[attr.target]="item.target"
>
{{ item.name }}
<mat-icon class="open-in-new" *ngIf="item.icon">{{
item.icon
}}</mat-icon>
</a>
</ng-container>
<ng-template #router>
<a
mat-list-item
(click)="navBarService.toggle()"
[routerLink]="item.routerLink"
>
{{ item.name }}
</a>
</ng-template>
</ng-container>
<mat-divider></mat-divider>
</div>
<mat-divider></mat-divider>
Expand Down

0 comments on commit 37d6244

Please sign in to comment.