Browse Source

UI: Add custom translate for notification message

pull/8578/head
Artem Dzhereleiko 3 years ago
parent
commit
5509b93cc8
  1. 4
      ui-ngx/src/app/shared/components/notification/notification.component.html
  2. 5
      ui-ngx/src/app/shared/components/notification/notification.component.ts

4
ui-ngx/src/app/shared/components/notification/notification.component.html

@ -28,8 +28,8 @@
</mat-icon> </mat-icon>
</ng-template> </ng-template>
<div class="content" fxFlex> <div class="content" fxFlex>
<div class="title" [innerHTML]="(utils.customTranslation(notification.subject, notification.subject) | safe: 'html' )"></div> <div class="title" [innerHTML]="(title | safe: 'html' )"></div>
<div class="message" [innerHTML]="(notification.text | safe: 'html' )"></div> <div class="message" [innerHTML]="(message | safe: 'html' )"></div>
<button *ngIf="showButton" mat-stroked-button class="button" color="primary" <button *ngIf="showButton" mat-stroked-button class="button" color="primary"
(click)="navigate($event)"> (click)="navigate($event)">
{{ buttonLabel }} {{ buttonLabel }}

5
ui-ngx/src/app/shared/components/notification/notification.component.ts

@ -62,6 +62,9 @@ export class NotificationComponent implements OnInit {
currentDate = Date.now(); currentDate = Date.now();
title = '';
message = '';
constructor( constructor(
public utils: UtilsService, public utils: UtilsService,
private router: Router private router: Router
@ -72,6 +75,8 @@ export class NotificationComponent implements OnInit {
this.showIcon = this.notification.additionalConfig?.icon?.enabled; this.showIcon = this.notification.additionalConfig?.icon?.enabled;
this.showButton = this.notification.additionalConfig?.actionButtonConfig?.enabled; this.showButton = this.notification.additionalConfig?.actionButtonConfig?.enabled;
this.hideMarkAsReadButton = this.notification.status === NotificationStatus.READ; this.hideMarkAsReadButton = this.notification.status === NotificationStatus.READ;
this.title = this.utils.customTranslation(this.notification.subject, this.notification.subject);
this.message = this.utils.customTranslation(this.notification.text, this.notification.text);
if (this.showButton) { if (this.showButton) {
this.buttonLabel = this.utils.customTranslation(this.notification.additionalConfig.actionButtonConfig.text, this.buttonLabel = this.utils.customTranslation(this.notification.additionalConfig.actionButtonConfig.text,
this.notification.additionalConfig.actionButtonConfig.text); this.notification.additionalConfig.actionButtonConfig.text);

Loading…
Cancel
Save