diff --git a/login/userMini.component.ts b/login/userMini.component.ts index ea4caec3..00a6041f 100644 --- a/login/userMini.component.ts +++ b/login/userMini.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Session, User} from './utils/helper.class'; import {RouterHelper} from '../utils/routerHelper.class'; @@ -6,72 +6,44 @@ import {Subscriber} from "rxjs"; import {MenuItem} from "../sharedComponents/menu"; import {UserManagementService} from "../services/user-management.service"; -// declare var logoutClicked; +declare var UIkit; + @Component({ selector: 'user-mini', template: ` - - - - - -
  • - + - - Sign in - - - - - - - + Sign in
  • -
  • Log out
  • +
  • Log out
  • @@ -172,9 +122,10 @@ export class UserMiniComponent implements OnInit, OnChanges { @Input() logOutUrl; @Input() cookieDomain; @Input() dark: boolean = false; - subscriptions = []; + @Output() closeCanvasEmitter: EventEmitter = new EventEmitter(); + private subscriptions = []; - constructor(private router: Router, private route: ActivatedRoute, private userManagementService: UserManagementService) { + constructor(private router: Router, private route: ActivatedRoute, private userManagementService: UserManagementService) { } ngOnInit() { @@ -189,7 +140,7 @@ export class UserMiniComponent implements OnInit, OnChanges { this.initUser(); } } - + ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscriber) { @@ -198,6 +149,10 @@ export class UserMiniComponent implements OnInit, OnChanges { }); } + closeCanvas() { + this.closeCanvasEmitter.emit(true); + } + initUser() { if (this.user) { this.loggedIn = true; @@ -222,14 +177,12 @@ export class UserMiniComponent implements OnInit, OnChanges { logIn() { this.userManagementService.login(); } - + isTheActiveSubMenu(menuItem: MenuItem): boolean { let currentRoute = this.router.url.split('?')[0]; - if (menuItem.route == currentRoute || menuItem.route == (currentRoute + "/") ) { - return true; - } - return false; + return menuItem.route == currentRoute || menuItem.route == (currentRoute + "/"); } + parseName() { this.firstLetters = ""; if (this.user && this.user.firstname) { diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index d98e5150..c138489a 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -32,95 +32,71 @@ -
    - @@ -161,12 +137,10 @@ --> -
    - -
    -
    - +
    +
    -
    -
    - -
    -
    -
    + + +
    diff --git a/sharedComponents/navigationBar.component.ts b/sharedComponents/navigationBar.component.ts index be35cb3e..16f4c17d 100644 --- a/sharedComponents/navigationBar.component.ts +++ b/sharedComponents/navigationBar.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, OnDestroy, OnInit} from '@angular/core'; +import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Session, User} from '../login/utils/helper.class'; import {ConfigurationService} from '../utils/configuration/configuration.service'; @@ -7,6 +7,8 @@ import {EnvProperties} from '../utils/properties/env-properties'; import {Subscription} from 'rxjs'; import {HelpContentService} from '../services/help-content.service'; +declare var UIkit; + export interface Header { route?: string, url?: string, @@ -68,6 +70,10 @@ export class NavigationBarComponent implements OnInit, OnDestroy { sub.unsubscribe(); } } + + closeCanvas(element) { + UIkit.offcanvas(element).hide(); + } initialize() { if ((['provide', 'develop']).indexOf(this.portal) != -1) { @@ -88,13 +94,13 @@ export class NavigationBarComponent implements OnInit, OnDestroy { this.subs.push(this.config.communityInformationState.subscribe(data => { if (data) { if (data['entities']) { - for (var i = 0; i < data['entities'].length; i++) { + for (let i = 0; i < data['entities'].length; i++) { this.showEntity['' + data['entities'][i]['pid'] + ''] = data['entities'][i]['isEnabled']; } } if (data['pages']) { - for (var i = 0; i < data['pages'].length; i++) { + for (let i = 0; i < data['pages'].length; i++) { this.showPage[data['pages'][i]['route']] = data['pages'][i]['isEnabled']; } @@ -116,8 +122,7 @@ export class NavigationBarComponent implements OnInit, OnDestroy { ); } } - - + isEnabled(required, enabled) { if (!required) { return true; @@ -143,7 +148,7 @@ export class NavigationBarComponent implements OnInit, OnDestroy { count--; } } - return (count > 0) ? true : false; + return (count > 0); } private handleError(message: string, error) {