Skip to content

Commit

Permalink
feat(importExport): add custom html for clarification (#1095)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre-Étienne Lord
  • Loading branch information
josee666 authored Oct 24, 2022
1 parent 337f0cc commit 7b47d68
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/geo/src/lib/import-export/import-export.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { MatTabsModule } from '@angular/material/tabs';
import { MatTooltipModule } from '@angular/material/tooltip';

import { IgoLanguageModule } from '@igo2/core';
import { IgoKeyValueModule, IgoDrapDropModule, IgoSpinnerModule } from '@igo2/common';
import { IgoKeyValueModule, IgoDrapDropModule, IgoSpinnerModule, IgoCustomHtmlModule } from '@igo2/common';

import { ExportButtonComponent } from './export-button/export-button.component';
import { ImportExportComponent } from './import-export/import-export.component';
Expand All @@ -40,6 +40,7 @@ import { IgoStyleListModule } from './style-list/style-list.module';
IgoSpinnerModule,
IgoKeyValueModule,
IgoDrapDropModule,
IgoCustomHtmlModule,
IgoStyleListModule.forRoot()
],
exports: [ImportExportComponent, DropGeoFileDirective, IgoStyleListModule, ExportButtonComponent],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@
</div>
</form>
<section class="mat-typography" *ngIf="selectedMode === 'import'">
<h4>{{'igo.geo.importExportForm.importClarifications' | translate}}</h4>
<ul>
<li>{{'igo.geo.importExportForm.importSizeMax' | translate: {size: fileSizeMb} }}</li>
<li>{{'igo.geo.importExportForm.importFormatAuthorized' | translate}}</li>
<li>{{'igo.geo.importExportForm.importShpZip' | translate}}</li>
</ul>
<div *ngIf="importHtmlClarifications === ''">
<h4>{{'igo.geo.importExportForm.importClarifications' | translate}}</h4>
<ul>
<li>{{'igo.geo.importExportForm.importSizeMax' | translate: {size: fileSizeMb} }}</li>
<li>{{'igo.geo.importExportForm.importFormatAuthorized' | translate}}</li>
<li>{{'igo.geo.importExportForm.importShpZip' | translate}}</li>
</ul>
</div>
<igo-custom-html *ngIf="importHtmlClarifications !== ''" class="mat-typography"
[html]="importHtmlClarifications">
</igo-custom-html>
</section>

<section class="mat-typography" *ngIf="(exportableLayers$ | async).length === 0 && selectedMode === 'export'">
Expand Down Expand Up @@ -167,4 +172,8 @@ <h4>{{'igo.geo.importExportForm.exportNoLayersExportable' | translate}}</h4>
<igo-spinner [shown]="loading$ | async"></igo-spinner>
</div>

<igo-custom-html *ngIf="exportHtmlClarifications !== ''" class="mat-typography"
[html]="exportHtmlClarifications">
</igo-custom-html>

</form>
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export class ImportExportComponent implements OnDestroy, OnInit {
private formLayer$$: Subscription;
private exportOptions$$: Subscription;

public importHtmlClarifications: string;
public exportHtmlClarifications: string;

private espgCodeRegex = new RegExp('^\\d{4,6}');
private clientSideFileSizeMax: number;
Expand Down Expand Up @@ -167,6 +169,8 @@ export class ImportExportComponent implements OnDestroy, OnInit {
this.loadConfig();
this.buildForm();
this.computeProjections();
this.importHtmlClarifications = this.languageService.translate.instant('igo.geo.importExportForm.importHtmlClarifications');
this.exportHtmlClarifications = this.languageService.translate.instant('igo.geo.importExportForm.exportHtmlClarifications');
}

ngOnInit() {
Expand Down
2 changes: 2 additions & 0 deletions packages/geo/src/locale/en.geo.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@
"importSizeMax": "The file size limit is {{size}} Mb",
"importFormatAuthorized": "Formats authorized: geojson, kml, gpx, gml, shapefile",
"importShpZip": "Shapefiles must be zipped AND geometries stored in Latitude Longitude coordinate (EPSG:4326/WGS:84)",
"importHtmlClarifications": "",
"exportHtmlClarifications": "",
"other": "other",
"others": "others",
"projections": {
Expand Down
2 changes: 2 additions & 0 deletions packages/geo/src/locale/fr.geo.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@
"importSizeMax": "La taille limite du fichier est de {{size}} Mo",
"importFormatAuthorized": "Formats autorisés: geojson, kml, gpx, gml, shapefile",
"importShpZip": "Les shapefiles doivent être compressés (zippés) ET leurs géométries doivent être en coordonnées Latitude Longitude (EPSG:4326/WGS84)",
"importHtmlClarifications": "",
"exportHtmlClarifications": "",
"other": "autre",
"others": "autres",
"projections": {
Expand Down

0 comments on commit 7b47d68

Please sign in to comment.