Skip to content

Commit

Permalink
patron profile: fix wrong url on the contributor
Browse files Browse the repository at this point in the history
* Closes rero/rero-ils#3092.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Sep 29, 2022
1 parent 0ce8e85 commit aea6fae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<li *ngFor="let contribution of document.contribution; let last = last; let i = index" class="list-inline-item">
<span *ngIf="!contribution.agent.pid" [innerHTML]="contribution | contributionFormat: true"></span>
<a *ngIf="contribution.agent.pid"
[innerHTML]="contribution | contributionFormat"
[routerLink]="['/records', 'persons', 'detail', contribution.agent.pid]">
href="/{{ viewcode }}/{{ getContributorLinkType(contribution.agent.type) }}/{{ contribution.agent.pid }}"
[innerHTML]="contribution | contributionFormat">
</a>
<ng-container *ngIf="!last">; </ng-container>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aea6fae

Please sign in to comment.