Commit af2b03a5 authored by Matthieu BENOIST's avatar Matthieu BENOIST
Browse files

Merge branch 'DOS0078564' into 'master'

Change licence urls according to language

See merge request !109
parents e2d72835 85e59905
Pipeline #8707 passed with stage
in 7 minutes and 49 seconds
......@@ -21,14 +21,28 @@
<span class="info-title" i18n="@@dataset.info.legalContraints">
Terms of use
</span>
<a class="link" [href]="license.url" target="_blank" *ngIf="license.url; else simpleLicenseName">
<span>{{ license.nameFr }}</span><br>
<span>{{ license.nameEn }}</span>
</a>
<ng-template #simpleLicenseName>
<div *ngIf="isFr(); else englishLicense">
<a class="link" [href]="license.urlFr" target="_blank" *ngIf="license.urlFr; else simpleLicenseNameFr">
<span>{{ license.nameFr }}</span>
</a><br>
<a [href]="license.urlEn" target="_blank" *ngIf="license.urlEn; else simpleLicenseNameEn">
<span>{{ license.nameEn }}</span>
</a>
</div>
<ng-template #englishLicense>
<a class="link" [href]="license.urlEn" target="_blank" *ngIf="license.urlEn; else simpleLicenseNameEn">
<span>{{ license.nameEn }}</span>
</a><br>
<a [href]="license.urlFr" target="_blank" *ngIf="license.urlFr; else simpleLicenseNameFr">
<span>{{ license.nameFr }}</span>
</a>
</ng-template>
<ng-template #simpleLicenseNameFr>
<span>{{ license.nameFr }}</span>
</ng-template>
<ng-template #simpleLicenseNameEn>
<span>{{ license.nameEn }}</span>
</ng-template>
</div>
<app-info-partners class="mobile-section"></app-info-partners>
......
import { isFormattedError } from '@angular/compiler';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Subscription } from 'rxjs';
import { datatsetDataRepresentationType } from '../../../../i18n/traductions';
import { AppRoutes } from '../../../routes';
import { environment } from '../../../../environments/environment';
import { License, Metadata, typesMetadata } from '../../../shared/models';
import { DatasetDetailService } from '../../services';
import { UsageStatisticsService } from '../../services/usage-statistics.service';
......@@ -115,8 +117,15 @@ export class DatasetInfoComponent implements OnInit, OnDestroy {
get keywords() {
return this.metadata.keyword;
}
isFr(): boolean {
return window.location.href.includes(environment.angularAppHost.en) ?
false : true;
}
}
interface IGeographicalInfo {
representationType: string;
scale: string;
......
......@@ -124,7 +124,8 @@ export interface ILicense {
nameEn?: string;
acronymFr?: string;
acronymEn?: string;
url?: string;
urlFr?: string;
urlEn?: string;
}
export class License {
......@@ -132,14 +133,17 @@ export class License {
nameEn: string;
acronymFr: string;
acronymEn: string;
url: string;
urlFr: string;
urlEn: string;
constructor(data: ILicense) {
this.nameFr = data && data.nameFr ? data.nameFr : null;
this.nameEn = data && data.nameEn ? data.nameEn : null;
this.acronymFr = data && data.acronymFr ? data.acronymFr : null;
this.acronymEn = data && data.acronymEn ? data.acronymEn : null;
this.url = data && data.url ? data.url : null;
this.urlFr = data && data.urlFr ? data.urlFr : null;
this.urlEn = data && data.urlEn ? data.urlEn : this.urlFr;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment