Skip to content

Commit

Permalink
image label fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Collins committed Dec 6, 2023
1 parent ae5c1c9 commit 54a1ba4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions grails-app/assets/javascripts/species.show.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ function loadOverviewImages() {
}
if (data && data.totalRecords > 0) {
record.uuid = data.occurrences[0].uuid;
record.imageMetadata = data.occurrences[0].imageMetadata
}

if (countPreferredImages == 0) {
Expand Down Expand Up @@ -1010,17 +1011,24 @@ function getImageTitleFromOccurrence(el) {
briefHtml += ((el.typeStatus) ? ' | ' : br) + el.institutionName;
}

if (el.imageMetadata && el.imageMetadata.length > 0 && el.imageMetadata[0].creator != null) {
if (briefHtml.length > 0) briefHtml += br;
briefHtml += "Photographer: " + el.imageMetadata[0].creator;
} else if (el.imageMetadata && el.imageMetadata.length > 0 && el.imageMetadata[0].rightsHolder != null) {
if (briefHtml.length > 0) briefHtml += br;
briefHtml += "Rights holder: " + el.imageMetadata[0].rightsHolder;
if (el.imageMetadata && el.imageMetadata.length > 0) {
$.each(el.imageMetadata, function (idx, im) {
if (im.imageId == el.image) {
if (im.creator != null) {
if (briefHtml.length > 0) briefHtml += br;
briefHtml += "Photographer: " + im.creator;
} else if (im.rightsHolder != null) {
if (briefHtml.length > 0) briefHtml += br;
briefHtml += "Rights holder: " + im.rightsHolder;
}
}
})
} else if (el.collector) {
if (briefHtml.length > 0) briefHtml += br;
briefHtml += "Supplied by: " + el.collector;
}


return briefHtml;
}

Expand Down

0 comments on commit 54a1ba4

Please sign in to comment.