Update: replaced logic of allMetadataValues method by allMetadataNoExcludingValues logic

This commit is contained in:
Oscar Chacón
2024-05-11 17:37:38 -06:00
parent 2530845b9b
commit 5e59403779
2 changed files with 2 additions and 12 deletions

View File

@@ -29,7 +29,7 @@
<span *ngIf="dso.firstMetadataValue('dc.date.issued')" class="item-list-date" [innerHTML]="firstMetadataValue('dc.date.issued')"></span>)
</ng-container>
<span *ngIf="dso.allMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0" class="item-list-authors">
<span *ngFor="let author of allMetadataNoExcludingValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
<span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
<span *ngIf="!last">; </span>
</span>

View File

@@ -37,23 +37,13 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
}
}
/**
* Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights.
*
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
* @returns {string[]} the matching string values or an empty array.
*/
allMetadataValues(keyOrKeys: string | string[]): string[] {
return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys);
}
/**
* Gets all matching metadata string values from hitHighlights or dso metadata.
*
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
* @returns {string[]} the matching string values or an empty array.
*/
allMetadataNoExcludingValues(keyOrKeys: string | string[]): string[] {
allMetadataValues(keyOrKeys: string | string[]): string[] {
let dsoMetadata: string[] = Metadata.allValues([this.dso.metadata], keyOrKeys);
let highlights: string[] = Metadata.allValues([this.object.hitHighlights], keyOrKeys);
let removedHighlights: string[] = highlights.map(str => str.replace(/<\/?em>/g, ''));