diff --git a/login/user.component.html b/login/user.component.html index b63dc0f9..df97b4f1 100644 --- a/login/user.component.html +++ b/login/user.component.html @@ -4,7 +4,7 @@
-
+
User Information
Full name {{user.fullname}} diff --git a/sharedComponents/menu.ts b/sharedComponents/menu.ts index 7af41976..99505b1a 100644 --- a/sharedComponents/menu.ts +++ b/sharedComponents/menu.ts @@ -7,6 +7,8 @@ export class MenuItem { entitiesRequired: string[] = []; // openaire entities used in page "publication, dataset, organization, software, project, datasource" routeRequired: string[] = []; // the routes that if aren't enable the menu item doesn't make sense params: any = {}; + markAsActive:boolean; + constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params) { this.id = id; @@ -17,6 +19,10 @@ export class MenuItem { this.entitiesRequired = entitiesRequired; this.routeRequired = routeRequired; this.params = params; + this.markAsActive = true; + } + public setMarkAsActive(showActive:boolean){ + this.markAsActive = showActive; } } diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 5973b35d..bf60d12b 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -165,7 +165,8 @@ Home -
  • +
  • {{menu.rootItem.title}} diff --git a/sharedComponents/navigationBar.component.ts b/sharedComponents/navigationBar.component.ts index b45228b2..0cb29afd 100644 --- a/sharedComponents/navigationBar.component.ts +++ b/sharedComponents/navigationBar.component.ts @@ -38,6 +38,7 @@ export class NavigationBarComponent { showEntity ={}; showPage ={}; specialAnnouncementContent:string= null; + activeRouteEnabled = false; constructor( private router: Router, private route: ActivatedRoute, private config: ConfigurationService) { @@ -51,6 +52,7 @@ export class NavigationBarComponent { }catch (e) { } } + this.activeRouteEnabled = false; this.sub = this.route.queryParams.subscribe(params => { this.initialize(); }); @@ -60,6 +62,7 @@ export class NavigationBarComponent { this.sub.unsubscribe(); } initialize(){ + this.activeRouteEnabled = false; if(Session.isLoggedIn() && (Session.isClaimsCurator() || Session.isPortalAdministrator())){ this.isAuthorized = true; }else { @@ -121,4 +124,22 @@ if( this.properties.adminToolsAPIURL && this.communityId ){ getCurrentRoute(){ return this.router.url.split('?')[0]; } + isTheActiveMenu(menu:RootMenuItem):boolean{ + let currentRoute = this.getCurrentRoute(); + if(!menu.rootItem.markAsActive){ + return false; + } + if( currentRoute == menu.rootItem.route){ + this.activeRouteEnabled = true; + return true; + }else if(menu.items.length >0){ + for (let menuItem of menu.items){ + if(menuItem.route == currentRoute){ + this.activeRouteEnabled = true; + return true; + } + } + } + return false; + } }