replaced 'question mark' with 'SY' avatar and 'Unknown' with 'System' value on CREATED BY column for dossier templates listing

This commit is contained in:
Valentin 2021-11-10 15:12:51 +02:00
parent e5a1177a68
commit 6f85ee585d
4 changed files with 9 additions and 1 deletions

View File

@ -80,6 +80,7 @@
[defaultValue]="'unknown' | translate"
[user]="dossierTemplate.createdBy"
[withName]="true"
[showSystem]="true"
></redaction-initials-avatar>
</div>

View File

@ -4,7 +4,7 @@
[matTooltipPosition]="tooltipPosition"
[matTooltip]="userName"
>
{{ _user | name: { showInitials: true } }}
{{ _user | name: { showInitials: true, showSystem: showSystem } }}
</div>
<div *ngIf="withName" [class.disabled]="disabled" class="clamp-2 username">
{{ userName }}

View File

@ -16,6 +16,7 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnInit,
@Input() size: 'small' | 'large' = 'small';
@Input() withName = false;
@Input() showYou = false;
@Input() showSystem = false;
@Input() tooltipPosition: 'below' | 'above' = 'above';
@Input() defaultValue = this._translateService.instant('initials-avatar.unassigned');
colorClass: string;
@ -80,6 +81,7 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnInit,
this.namePipeOptions = {
showYou: this.showYou,
defaultValue: this.defaultValue,
showSystem: this.showSystem,
};
}
}

View File

@ -18,6 +18,7 @@ function getInitials(name: string) {
export interface NamePipeOptions {
showYou?: boolean;
showInitials?: boolean;
showSystem?: boolean;
defaultValue?: string;
}
@ -32,6 +33,10 @@ export class NamePipe implements PipeTransform {
transform(value?: User | string, options = this._defaultOptions): string {
let name;
if (!value && options?.showSystem) {
value = 'system';
}
if (!value && options?.showInitials) {
return '?';
}