Commit 4fa272eb authored by Jérémy Destin's avatar Jérémy Destin Committed by Célia Michotey
Browse files

feat: Add double links (external link and link to the card in the app) on result page. GNP-5490

parent 246a37c1
...@@ -146,4 +146,3 @@ export class GermplasmCardComponent implements OnInit { ...@@ -146,4 +146,3 @@ export class GermplasmCardComponent implements OnInit {
|| (this.germplasmGnpis.breeder); || (this.germplasmGnpis.breeder);
} }
} }
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
<a class="title" *ngIf="getURL()" [href]="getURL()"> <a class="title" *ngIf="getURL()" [href]="getURL()">
{{ document["schema:name"] }} {{ document["schema:name"] }}
</a> </a>
</h5>
<h5>
<a class="title" *ngIf="getRouterLink()" [routerLink]="getRouterLink()" [queryParams]="getQueryParam()"> <a class="title" *ngIf="getRouterLink()" [routerLink]="getRouterLink()" [queryParams]="getQueryParam()">
{{ document["schema:name"] }} (go to this {{ document["@type"] }} card)
</a> </a>
</h5> </h5>
<span class="text-justify description"> <span class="text-justify description">
......
a {
text-decoration: none;
}
.badge-source { .badge-source {
background-color: #b54646; background-color: #b54646;
color: white; color: white;
......
...@@ -94,7 +94,7 @@ describe('DocumentComponent', () => { ...@@ -94,7 +94,7 @@ describe('DocumentComponent', () => {
tester.detectChanges(); tester.detectChanges();
expect(component).toBeTruthy(); expect(component).toBeTruthy();
expect(tester.title).toContainText('doc_name'); expect(tester.title).toContainText('(go to this Germplasm card)');
expect(tester.title.nativeElement['routerLink']).toEqual('/germplasm'); expect(tester.title.nativeElement['routerLink']).toEqual('/germplasm');
expect(component.getQueryParam().id).toEqual('g1'); expect(component.getQueryParam().id).toEqual('g1');
......
...@@ -22,22 +22,22 @@ export class DocumentComponent implements OnInit { ...@@ -22,22 +22,22 @@ export class DocumentComponent implements OnInit {
needTruncation = false; needTruncation = false;
opened = false; opened = false;
getURL() { getURL() {
return this.document['schema:url'] || ''; return this.document['schema:url'] || '';
} }
getRouterLink() { getRouterLink() {
if (!this.getURL()) { for (const type of this.document['@type']) {
for (const type of this.document['@type']) { const cardUrl = DocumentComponent.CARD_TYPE[type];
const cardUrl = DocumentComponent.CARD_TYPE[type]; if (cardUrl === 'studies') {
if (cardUrl === 'studies') { return `/${cardUrl}/${this.document['schema:identifier']}`;
return `/${cardUrl}/${this.document['schema:identifier']}`; }
} if (cardUrl === 'germplasm') {
if (cardUrl === 'germplasm') { return `/${cardUrl}`;
return `/${cardUrl}`;
}
} }
} }
return ''; return '';
} }
......
Supports Markdown
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