Adds user default login icon
This commit is contained in:
parent
1a160edece
commit
0b573e4256
|
@ -22,6 +22,7 @@
|
|||
|
||||
<div *ngIf="isAuthenticated();else loginoption" class="col-auto">
|
||||
<img mat-card-avatar *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()" (click)="openProfile()">
|
||||
<img mat-card-avatar *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()" (click)="openProfile()">
|
||||
</div>
|
||||
|
||||
<ng-template #loginoption>
|
||||
|
|
|
@ -92,13 +92,17 @@ export class NavigationComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public getDefaultAvatar(): string {
|
||||
return 'assets/images/profile-placeholder.png';
|
||||
}
|
||||
|
||||
openProfile() {
|
||||
const dialogRef = this.dialog.open(UserDialogComponent, {
|
||||
hasBackdrop: true,
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<div mat-dialog-title>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()"
|
||||
[src]="this.getPrincipalAvatar()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()">
|
||||
</div>
|
||||
<span class="user-label col">{{this.getPrincipalName()}}</span>
|
||||
</div>
|
||||
|
|
|
@ -36,13 +36,17 @@ export class UserDialogComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current() && this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current() && this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current() && this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public getDefaultAvatar(): string {
|
||||
return 'assets/images/profile-placeholder.png';
|
||||
}
|
||||
|
||||
public navigateToProfile() {
|
||||
this.dialogRef.close();
|
||||
this.router.navigate(['/profile']);
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
|
||||
<!-- Login -->
|
||||
<li class="nav-item" *ngIf="isAuthenticated();else loginoption">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()"
|
||||
[src]="this.getPrincipalAvatar()" (click)="openProfile()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()" (click)="openProfile()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()" (click)="openProfile()">
|
||||
</li>
|
||||
<ng-template #loginoption>
|
||||
<button mat-button [routerLink]=" ['/login'] ">
|
||||
|
|
|
@ -152,13 +152,17 @@ export class NavbarComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public getDefaultAvatar(): string {
|
||||
return 'assets/images/profile-placeholder.png';
|
||||
}
|
||||
|
||||
public isAdmin(): boolean {
|
||||
if (!this.authentication.current()) { return false; }
|
||||
const principalRoles = this.authentication.current().authorities;
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" *ngIf="isAuthenticated();else loginoption">
|
||||
<p style="display: flex; align-items: center;" [routerLink]=" ['/profile']">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()"
|
||||
[src]="this.getPrincipalAvatar()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()">
|
||||
<span class="d-lg-none d-md-block">{{ 'SIDE-BAR.ACCOUNT' | translate }}</span>
|
||||
</p>
|
||||
</a>
|
||||
|
|
|
@ -146,13 +146,17 @@ export class SidebarComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public getDefaultAvatar(): string {
|
||||
return 'assets/images/profile-placeholder.png';
|
||||
}
|
||||
|
||||
public isAuthenticated(): boolean {
|
||||
const myBollean = this.isAdmin();
|
||||
return !(!this.authentication.current());
|
||||
|
|
Loading…
Reference in New Issue