Ajout des traductions
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
<div class="content">
|
||||
<div *ngIf="dataSourceTable != null else loading">
|
||||
<button mat-raised-button color="accent" (click)="openDialogToAdd()" *ngIf="isUserAdmin == true">Add a aircraft</button>
|
||||
<button mat-raised-button color="accent" (click)="openDialogToAdd()" *ngIf="isUserAdmin == true">{{ 'List_Aircrafts_Add' | translate }}</button>
|
||||
|
||||
<table mat-table [dataSource]="dataSourceTable">
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef>ID</th>
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'List_Aircrafts_Header_Id' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.id}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef>Name</th>
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'List_Aircrafts_Header_Name' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.name}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="imageData">
|
||||
<th mat-header-cell *matHeaderCellDef>Image</th>
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'List_Aircrafts_Header_Image' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let element"><img src="{{element.imageData}}" alt="No image" style="width: 128px;"></td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { AircraftService } from '../../services/aircraft.service';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
@@ -25,7 +26,8 @@ export class ListOfAircraftsComponent implements OnInit {
|
||||
constructor(private serviceApi: AircraftService,
|
||||
private serviceComm: ServiceComm,
|
||||
private authenticationService: AuthenticationService,
|
||||
public dialog: MatDialog) {
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
this.isUserAdmin = this.authenticationService.currentUserValue.roles === "admin";
|
||||
}
|
||||
|
||||
@@ -36,7 +38,13 @@ export class ListOfAircraftsComponent implements OnInit {
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
});
|
||||
this.serviceComm.UpdatedComponentTitle('List of aircrafts');
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data)=> {
|
||||
if (data === true){
|
||||
this.updateTitle();
|
||||
}
|
||||
});
|
||||
|
||||
this.updateTitle();
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
|
||||
@@ -54,4 +62,10 @@ export class ListOfAircraftsComponent implements OnInit {
|
||||
openDialogToAdd() {
|
||||
this.dialog.open(NewAircraftComponent);
|
||||
}
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListAircrafts_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user