From aea6fae6af7e30e4fc965e5bc9db6614a990a856 Mon Sep 17 00:00:00 2001 From: Bertrand Zuchuat Date: Thu, 15 Sep 2022 08:47:21 +0200 Subject: [PATCH] patron profile: fix wrong url on the contributor * Closes rero/rero-ils#3092. Co-Authored-by: Bertrand Zuchuat --- .../patron-profile-document.component.html | 4 ++-- .../patron-profile-document.component.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/projects/public-search/src/app/patron-profile/patron-profile-document/patron-profile-document.component.html b/projects/public-search/src/app/patron-profile/patron-profile-document/patron-profile-document.component.html index 761572398..70faf0bb1 100644 --- a/projects/public-search/src/app/patron-profile/patron-profile-document/patron-profile-document.component.html +++ b/projects/public-search/src/app/patron-profile/patron-profile-document/patron-profile-document.component.html @@ -23,8 +23,8 @@
  • + href="/{{ viewcode }}/{{ getContributorLinkType(contribution.agent.type) }}/{{ contribution.agent.pid }}" + [innerHTML]="contribution | contributionFormat"> ;
  • diff --git a/projects/public-search/src/app/patron-profile/patron-profile-document/patron-profile-document.component.ts b/projects/public-search/src/app/patron-profile/patron-profile-document/patron-profile-document.component.ts index 6b454a1e0..50801c4be 100644 --- a/projects/public-search/src/app/patron-profile/patron-profile-document/patron-profile-document.component.ts +++ b/projects/public-search/src/app/patron-profile/patron-profile-document/patron-profile-document.component.ts @@ -53,6 +53,19 @@ export class PatronProfileDocumentComponent implements OnInit { ).filter(Boolean).join(' | '); } + /** + * Translate contribution type to parameter + * @param type - contribution type + * @returns string, contribution parameter + */ + getContributorLinkType(type: string): string { + switch (type) { + case 'bf:Person': return 'persons'; + case 'bf:Organisation': return 'corporate-bodies'; + default: return type; + } + } + // CONSTRUCTOR & HOOKS ====================================================== /** * Constructor