<div class="row">
<div class="col-lg-12 font-weight-bold">
<!-- nbsp allows the column to take shape when no value exists -->
- <a href="javascript:void(0)"
- (click)="navigateToRecord(summary)">
- {{summary.display.title || ' '}}
- </a>
+ <ng-container *ngIf="hasMrConstituentRecords(summary)">
+ <a routerLink="/staff/catalog/search"
+ [queryParams]="appendFromMrParam(summary)">
+ {{summary.display.title || ' '}}
+ </a>
+ </ng-container>
+ <ng-container *ngIf="!hasMrConstituentRecords(summary)">
+ <a routerLink="/staff/catalog/record/{{summary.id}}"
+ [queryParams]="currentParams()">
+ {{summary.display.title || ' '}}
+ </a>
+ </ng-container>
</div>
</div>
<div class="row pt-2">
this.staffCat.search();
}
- /**
- * Propagate the search params along when navigating to each record.
- */
- navigateToRecord(summary: BibRecordSummary) {
+
+ // Returns the URL parameters for the current page plus the
+ // "fromMetarecord" param used for linking title links to
+ // MR constituent result records list.
+ appendFromMrParam(summary: BibRecordSummary): any {
+ this.searchContext.termSearch.fromMetarecord = summary.metabibId;
const params = this.catUrl.toUrlParams(this.searchContext);
+ this.searchContext.termSearch.fromMetarecord = null;
+ return params;
+ }
- // Jump to metarecord constituent records page when a
- // MR has more than 1 constituents.
- if (summary.metabibId && summary.metabibRecords.length > 1) {
- this.searchContext.termSearch.fromMetarecord = summary.metabibId;
- this.staffCat.search();
- return;
- }
+ // Returns true if the selected record summary is a metarecord summary
+ // and it links to more than one constituent bib record.
+ hasMrConstituentRecords(summary: BibRecordSummary): boolean {
+ return (
+ summary.metabibId && summary.metabibRecords.length > 1
+ );
+ }
- this.router.navigate(
- ['/staff/catalog/record/' + summary.id], {queryParams: params});
+ currentParams(): any {
+ return this.catUrl.toUrlParams(this.searchContext);
}
toggleBasketEntry() {