Skip to content

Commit

Permalink
fix(thumbnail): display by isbn if no link
Browse files Browse the repository at this point in the history
Display thumbnail by isbn, if no thumbnail link is available
in the electronicLocator field.

* Closes rero/rero-ils#3755.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Sep 23, 2024
1 parent 5b9fc2e commit b94adc7
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions projects/shared/src/lib/view/thumbnail/thumbnail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,10 @@ export class ThumbnailComponent implements OnInit {
ngOnInit() {
if (this.record && this.record.metadata) {
this.coverUrl = `/static/images/icon_${this.record.metadata.type[0].main_type}.svg`;
if (this.record.metadata.electronicLocator) {
for (const electronicLocator of this.record.metadata.electronicLocator) {
if (electronicLocator.content === 'coverImage' && electronicLocator.type === 'relatedResource') {
this.coverUrl = electronicLocator.url;
this.svgImage = false;
break;
}
}
const cover = this.record.metadata.electronicLocator?.filter((e: any) => e.content === 'coverImage' && e.type=== 'relatedResource');
if (this.record.metadata.electronicLocator && cover.length > 0) {
this.coverUrl = cover[0].url;
this.svgImage = false;
} else if (this.record.metadata.identifiedBy) {
for (const identifier of this.record.metadata.identifiedBy) {
if (identifier.type === 'bf:Isbn') {
Expand Down

0 comments on commit b94adc7

Please sign in to comment.