From 1957c292860c22c467d5b6ec6dd1a47000a0e1b9 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 13 Dec 2019 15:40:13 +0000 Subject: [PATCH] [Trunk | Library]: 1. login/userMiniModule.module.ts: Created UserMiniModule to import it wherever needed. 2. navigationBar.module.ts: use UserMiniModule. 3. userMini.component.ts: [For dashboard]: Add input variable 'colors' ('dark' on light background - 'light' on dark background) & add classes according to background & show user icon when no letters in user's name. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57881 d315682c-612b-4755-9ff5-7f18f6832af3 --- login/userMini.component.ts | 25 +++++++++++++++++------- login/userMiniModule.module.ts | 21 ++++++++++++++++++++ sharedComponents/navigationBar.module.ts | 15 +++++++------- 3 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 login/userMiniModule.module.ts diff --git a/login/userMini.component.ts b/login/userMini.component.ts index d9342bb1..5da414e1 100644 --- a/login/userMini.component.ts +++ b/login/userMini.component.ts @@ -75,18 +75,27 @@ import{EnvProperties} from '../utils/properties/env-properties'; - - Sign in + + Sign in + + + + - + - - + + {{firstLetters}} + + + + + keyboard_arrow_down -
@@ -111,11 +120,12 @@ import{EnvProperties} from '../utils/properties/env-properties'; export class UserMiniComponent implements OnInit, OnChanges{ @Input() user: User; - public firstLetters: string = ""; public loggedIn: boolean = false; public isAuthorized: boolean = false; @Input() public mobileView:boolean = false ; + public firstLetters: string = ""; @Input() public dashboard: boolean = false; + @Input() public colors: string = "light"; // 'dark' on light background - 'light' on dark background public server: boolean = true; public routerHelper:RouterHelper = new RouterHelper(); @Input() userMenuItems; @@ -191,6 +201,7 @@ export class UserMiniComponent implements OnInit, OnChanges{ } parseName() { + this.firstLetters = ""; if(this.user && this.user.firstname) { this.firstLetters += this.user.firstname.substr(0, 1); } diff --git a/login/userMiniModule.module.ts b/login/userMiniModule.module.ts new file mode 100644 index 00000000..b53783ad --- /dev/null +++ b/login/userMiniModule.module.ts @@ -0,0 +1,21 @@ +import {NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from "@angular/router"; + +import {UserMiniComponent} from "./userMini.component"; + +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule + ], + declarations: [ + UserMiniComponent + ], + providers: [], + exports: [ + UserMiniComponent + ] +}) +export class UserMiniModule { +} diff --git a/sharedComponents/navigationBar.module.ts b/sharedComponents/navigationBar.module.ts index 3a6242f3..165c2f21 100644 --- a/sharedComponents/navigationBar.module.ts +++ b/sharedComponents/navigationBar.module.ts @@ -2,24 +2,25 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; -import { RouterModule } from "@angular/router"; +import { RouterModule } from "@angular/router"; -import {NavigationBarComponent} from './navigationBar.component'; +import { NavigationBarComponent} from './navigationBar.component'; -import {UserMiniComponent} from '../login/userMini.component'; - import { ConfigurationServiceModule } from '../utils/configuration/configurationService.module'; +import { UserMiniModule} from '../login/userMiniModule.module'; +import { ConfigurationServiceModule } from '../utils/configuration/configurationService.module'; @NgModule({ imports: [ CommonModule, FormsModule, - RouterModule, ConfigurationServiceModule + RouterModule, ConfigurationServiceModule, + UserMiniModule ], declarations: [ - NavigationBarComponent, UserMiniComponent + NavigationBarComponent ], providers:[], exports: [ - NavigationBarComponent,UserMiniComponent + NavigationBarComponent ] }) export class NavigationBarModule{ }