[Library|Trunk]

nav bar: fix active item/subitem route


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60205 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2021-01-11 13:54:07 +00:00
parent c19b346dc7
commit 346067ec5d
2 changed files with 14 additions and 4 deletions

View File

@ -213,12 +213,14 @@
<div *ngIf="menu.items.length > 0" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left"
style="top: 80px; left: 0px;" id="{{menu.rootItem.id}}" (click)="onClick(menu.rootItem.id)">
style="top: 80px; left: 0px;" id="{{menu.rootItem.id}}">
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
<div class="uk-first-column uk-height-max-medium uk-overflow-auto">
<ul class="uk-nav uk-navbar-dropdown-nav">
<ng-container *ngFor="let submenu of menu.items">
<li *ngIf="isEnabled(submenu.entitiesRequired,showEntity) && isEnabled(submenu.routeRequired, showPage) && (submenu.route.length > 0 || submenu.url.length > 0)">
<li *ngIf="isEnabled(submenu.entitiesRequired,showEntity) &&
isEnabled(submenu.routeRequired, showPage) && (submenu.route.length > 0 ||
submenu.url.length > 0)" [class.uk-active]="isTheActiveSubMenu(submenu)">
<a *ngIf="submenu.route.length > 0" routerLinkActive="uk-link"
routerLink="{{submenu.route}}" [queryParams]="submenu.params" [fragment]="submenu.fragment">{{submenu.title}}</a>
<a *ngIf="submenu.route.length == 0 && submenu.url.length > 0" routerLinkActive="uk-link"

View File

@ -168,12 +168,12 @@ export class NavigationBarComponent implements OnInit, OnDestroy{
if (!menu.rootItem.markAsActive) {
return false;
}
if (currentRoute == menu.rootItem.route) {
if (currentRoute == menu.rootItem.route || menu.rootItem.route == (currentRoute + "/")) {
this.activeRouteEnabled = true;
return true;
} else if (menu.items.length > 0) {
for (let menuItem of menu.items) {
if (menuItem.route == currentRoute) {
if (menuItem.route == currentRoute || menuItem.route == (currentRoute + "/")) {
this.activeRouteEnabled = true;
return true;
}
@ -181,4 +181,12 @@ export class NavigationBarComponent implements OnInit, OnDestroy{
}
return false;
}
isTheActiveSubMenu(menuItem: MenuItem): boolean {
let currentRoute = this.getCurrentRoute();
if (menuItem.route == currentRoute || menuItem.route == (currentRoute + "/") ) {
this.activeRouteEnabled = true;
return true;
}
return false;
}
}