diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html | 30 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts | 10 |
2 files changed, 27 insertions, 13 deletions
diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html index c737b40c7..530b9e376 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html | |||
@@ -1,9 +1,9 @@ | |||
1 | <div class="sub-menu" [ngClass]="{ 'no-scroll': isModalOpened }"> | 1 | <div class="sub-menu" [ngClass]="{ 'no-scroll': isModalOpened }"> |
2 | <ng-container *ngFor="let menuEntry of menuEntries; index as id"> | 2 | <ng-container *ngFor="let menuEntry of menuEntries; index as id"> |
3 | 3 | ||
4 | <a *ngIf="menuEntry.routerLink" [routerLink]="menuEntry.routerLink" routerLinkActive="active" class="title-page title-page-settings">{{ menuEntry.label }}</a> | 4 | <a *ngIf="menuEntry.routerLink && isDisplayed(menuEntry)" [routerLink]="menuEntry.routerLink" routerLinkActive="active" class="title-page title-page-settings">{{ menuEntry.label }}</a> |
5 | 5 | ||
6 | <div *ngIf="!menuEntry.routerLink" ngbDropdown class="parent-entry" | 6 | <div *ngIf="!menuEntry.routerLink && isDisplayed(menuEntry)" ngbDropdown class="parent-entry" |
7 | #dropdown="ngbDropdown" autoClose="outside"> | 7 | #dropdown="ngbDropdown" autoClose="outside"> |
8 | <span | 8 | <span |
9 | *ngIf="isInSmallView" | 9 | *ngIf="isInSmallView" |
@@ -25,11 +25,15 @@ | |||
25 | </span> | 25 | </span> |
26 | 26 | ||
27 | <div ngbDropdownMenu> | 27 | <div ngbDropdownMenu> |
28 | <a *ngFor="let menuChild of menuEntry.children" class="dropdown-item" [ngClass]="{ icon: hasIcons, active: suffixLabels[menuEntry.label] === menuChild.label }" [routerLink]="menuChild.routerLink"> | 28 | <ng-container *ngFor="let menuChild of menuEntry.children"> |
29 | <my-global-icon *ngIf="menuChild.iconName" [iconName]="menuChild.iconName" aria-hidden="true"></my-global-icon> | 29 | <a *ngIf="isDisplayed(menuChild)" class="dropdown-item" |
30 | [ngClass]="{ icon: hasIcons, active: suffixLabels[menuEntry.label] === menuChild.label }" | ||
31 | [routerLink]="menuChild.routerLink"> | ||
32 | <my-global-icon *ngIf="menuChild.iconName" [iconName]="menuChild.iconName" aria-hidden="true"></my-global-icon> | ||
30 | 33 | ||
31 | {{ menuChild.label }} | 34 | {{ menuChild.label }} |
32 | </a> | 35 | </a> |
36 | </ng-container> | ||
33 | </div> | 37 | </div> |
34 | </div> | 38 | </div> |
35 | </ng-container> | 39 | </ng-container> |
@@ -39,13 +43,15 @@ | |||
39 | <div class="modal-body"> | 43 | <div class="modal-body"> |
40 | <ng-container *ngFor="let menuEntry of menuEntries; index as id"> | 44 | <ng-container *ngFor="let menuEntry of menuEntries; index as id"> |
41 | <div [ngClass]="{ hidden: id !== currentMenuEntryIndex }"> | 45 | <div [ngClass]="{ hidden: id !== currentMenuEntryIndex }"> |
42 | <a *ngFor="let menuChild of menuEntry.children" | 46 | <ng-container *ngFor="let menuChild of menuEntry.children"> |
43 | [ngClass]="{ icon: hasIcons }" | 47 | <a *ngIf="isDisplayed(menuChild)" |
44 | [routerLink]="menuChild.routerLink" routerLinkActive="active" (click)="dismissOtherModals()"> | 48 | [ngClass]="{ icon: hasIcons }" |
45 | <my-global-icon *ngIf="menuChild.iconName" [iconName]="menuChild.iconName" aria-hidden="true"></my-global-icon> | 49 | [routerLink]="menuChild.routerLink" routerLinkActive="active" (click)="dismissOtherModals()"> |
50 | <my-global-icon *ngIf="menuChild.iconName" [iconName]="menuChild.iconName" aria-hidden="true"></my-global-icon> | ||
46 | 51 | ||
47 | {{ menuChild.label }} | 52 | {{ menuChild.label }} |
48 | </a> | 53 | </a> |
54 | </ng-container> | ||
49 | </div> | 55 | </div> |
50 | </ng-container> | 56 | </ng-container> |
51 | </div> | 57 | </div> |
diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts index 66f8f7e55..c3cd22307 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts | |||
@@ -9,12 +9,14 @@ import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' | |||
9 | export type TopMenuDropdownParam = { | 9 | export type TopMenuDropdownParam = { |
10 | label: string | 10 | label: string |
11 | routerLink?: string | 11 | routerLink?: string |
12 | isDisplayed?: () => boolean // Default: () => true | ||
12 | 13 | ||
13 | children?: { | 14 | children?: { |
14 | label: string | 15 | label: string |
15 | routerLink: string | 16 | routerLink: string |
16 | |||
17 | iconName?: GlobalIconName | 17 | iconName?: GlobalIconName |
18 | |||
19 | isDisplayed?: () => boolean // Default: () => true | ||
18 | }[] | 20 | }[] |
19 | } | 21 | } |
20 | 22 | ||
@@ -92,6 +94,12 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { | |||
92 | this.modalService.dismissAll() | 94 | this.modalService.dismissAll() |
93 | } | 95 | } |
94 | 96 | ||
97 | isDisplayed (obj: { isDisplayed?: () => boolean }) { | ||
98 | if (typeof obj.isDisplayed !== 'function') return true | ||
99 | |||
100 | return obj.isDisplayed() | ||
101 | } | ||
102 | |||
95 | private updateChildLabels (path: string) { | 103 | private updateChildLabels (path: string) { |
96 | this.suffixLabels = {} | 104 | this.suffixLabels = {} |
97 | 105 | ||