aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r--client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html8
-rw-r--r--client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts10
2 files changed, 15 insertions, 3 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 416bd9bc8..ee3346ea9 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,7 +1,7 @@
1<div class="sub-menu" [ngClass]="{ 'sub-menu-fixed': !isBroadcastMessageDisplayed, 'no-scroll': isModalOpened }"> 1<div class="sub-menu" [ngClass]="{ 'sub-menu-fixed': !isBroadcastMessageDisplayed, '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 && isDisplayed(menuEntry)" [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" #routerLink (click)="onActiveLinkScrollToTop(routerLink)">{{ menuEntry.label }}</a>
5 5
6 <div *ngIf="!menuEntry.routerLink && isDisplayed(menuEntry)" ngbDropdown class="parent-entry" 6 <div *ngIf="!menuEntry.routerLink && isDisplayed(menuEntry)" ngbDropdown class="parent-entry"
7 #dropdown="ngbDropdown" autoClose="true"> 7 #dropdown="ngbDropdown" autoClose="true">
@@ -28,7 +28,8 @@
28 <ng-container *ngFor="let menuChild of menuEntry.children"> 28 <ng-container *ngFor="let menuChild of menuEntry.children">
29 <a *ngIf="isDisplayed(menuChild)" class="dropdown-item" 29 <a *ngIf="isDisplayed(menuChild)" class="dropdown-item"
30 [ngClass]="{ icon: hasIcons }" 30 [ngClass]="{ icon: hasIcons }"
31 [routerLink]="menuChild.routerLink"> 31 [routerLink]="menuChild.routerLink"
32 #routerLink (click)="onActiveLinkScrollToTop(routerLink)">
32 <my-global-icon *ngIf="menuChild.iconName" [iconName]="menuChild.iconName" aria-hidden="true"></my-global-icon> 33 <my-global-icon *ngIf="menuChild.iconName" [iconName]="menuChild.iconName" aria-hidden="true"></my-global-icon>
33 34
34 {{ menuChild.label }} 35 {{ menuChild.label }}
@@ -46,7 +47,8 @@
46 <ng-container *ngFor="let menuChild of menuEntry.children"> 47 <ng-container *ngFor="let menuChild of menuEntry.children">
47 <a *ngIf="isDisplayed(menuChild)" 48 <a *ngIf="isDisplayed(menuChild)"
48 [ngClass]="{ icon: hasIcons }" 49 [ngClass]="{ icon: hasIcons }"
49 [routerLink]="menuChild.routerLink" routerLinkActive="active" (click)="dismissOtherModals()"> 50 [routerLink]="menuChild.routerLink" routerLinkActive="active"
51 #routerLink (click)="dismissOtherModals(); onActiveLinkScrollToTop(routerLink)">
50 <my-global-icon *ngIf="menuChild.iconName" [iconName]="menuChild.iconName" aria-hidden="true"></my-global-icon> 52 <my-global-icon *ngIf="menuChild.iconName" [iconName]="menuChild.iconName" aria-hidden="true"></my-global-icon>
51 53
52 {{ menuChild.label }} 54 {{ menuChild.label }}
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 043b647c9..ba5568595 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
@@ -94,6 +94,16 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy {
94 this.isModalOpened = false 94 this.isModalOpened = false
95 } 95 }
96 96
97 onActiveLinkScrollToTop (link: HTMLAnchorElement) {
98 if (!this.isBroadcastMessageDisplayed && this.router.url.includes(link.getAttribute('href'))) {
99 window.scrollTo({
100 left: 0,
101 top: 0,
102 behavior: 'smooth'
103 })
104 }
105 }
106
97 dismissOtherModals () { 107 dismissOtherModals () {
98 this.modalService.dismissAll() 108 this.modalService.dismissAll()
99 } 109 }