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