Implement toggleaccountmenu action
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -24,6 +24,6 @@
|
||||
<fm-resumable-file-upload></fm-resumable-file-upload>
|
||||
</ng-container>
|
||||
<div class="user-menu">
|
||||
<fm-user-menu [user]="user|async"></fm-user-menu>
|
||||
<fm-user-menu [user]="user|async" [showMenu]="accountMenuVisible|async"></fm-user-menu>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -35,6 +35,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
public fullScreen: Observable<boolean>;
|
||||
public routeLoading: Observable<boolean>;
|
||||
public menuVisible: Observable<boolean>;
|
||||
public accountMenuVisible: Observable<boolean>;
|
||||
public user:Observable<IUser>;
|
||||
@Input() showUploadProgress: boolean =true;
|
||||
|
||||
@@ -90,6 +91,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
this.fullScreen = this.store.select(appReducers.selectGetFullScreen);
|
||||
this.routeLoading = this.store.select(appReducers.selectGetRouteLoading);
|
||||
this.menuVisible = this.store.select(appReducers.SelectGetMenuVisible);
|
||||
this.accountMenuVisible = this.store.select(appReducers.SelectGetAccountMenuVisible);
|
||||
this.user = this.store.select(appReducers.SelectGetUser);
|
||||
this.InstallRouteEventHandler();
|
||||
this.InstallEventServiceEventHandler();
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<div *ngIf="user">
|
||||
<div (click)="toggle($event)" class="rounded-circle menu-button" [title]="user.name">
|
||||
<span>{{getLetter()}}</span>
|
||||
<div *ngIf="showMenu" class="card">
|
||||
<div [ngClass]="{'hidden':!showMenu}" class="card">
|
||||
<div class="card-body">
|
||||
<div class="username">{{user.name}}</div>
|
||||
<div><a href="#" (click)="logout($event)" i18n>logout</a></div>
|
||||
|
@@ -31,4 +31,8 @@ div.menu-button > span {
|
||||
|
||||
.card-body {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
@@ -1,6 +1,9 @@
|
||||
import { Component, OnInit,Input } from '@angular/core';
|
||||
import { OAuthService} from 'angular-oauth2-oidc'
|
||||
import { IUser } from '../../models/user';
|
||||
import {Store} from '@ngrx/store';
|
||||
import * as appReducers from '../../reducers/app-common.reducer';
|
||||
import * as appActions from '../../actions/app-common.actions';
|
||||
|
||||
@Component({
|
||||
selector: 'fm-user-menu',
|
||||
@@ -10,9 +13,9 @@ import { IUser } from '../../models/user';
|
||||
export class UserMenuComponent implements OnInit {
|
||||
|
||||
@Input() user:IUser;
|
||||
public showMenu:boolean = false
|
||||
@Input() showMenu:boolean;
|
||||
|
||||
constructor(private oauthService:OAuthService) { }
|
||||
constructor(private oauthService:OAuthService, private store: Store<appReducers.State>) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
@@ -26,15 +29,9 @@ export class UserMenuComponent implements OnInit {
|
||||
this.oauthService.logOut();
|
||||
}
|
||||
|
||||
hide(event:MouseEvent) {
|
||||
this.showMenu = false;
|
||||
}
|
||||
|
||||
show(event:MouseEvent) {
|
||||
this.showMenu=true;
|
||||
}
|
||||
|
||||
toggle(event:MouseEvent) {
|
||||
this.showMenu=!this.showMenu;
|
||||
}
|
||||
event.stopPropagation();
|
||||
this.store.dispatch(new appActions.ToggleAccountMenu());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user