diff --git a/themes/finc/js/covers.js b/themes/finc/js/covers.js index e1235742b58699e21bfe7b72972955af08eeb73a..b9ae3412c32efcb671085e96555470adcba65634 100644 --- a/themes/finc/js/covers.js +++ b/themes/finc/js/covers.js @@ -1,6 +1,6 @@ /* global Finc */ // show picture in large size after click within a modal -function registerCoverForModal(anchor, url) { +function registerCoverForModal(anchor, url, size) { if (anchor === null || anchor === undefined || url === null || url === undefined) { return; } @@ -8,7 +8,7 @@ function registerCoverForModal(anchor, url) { anchor.click(function(event) { event.preventDefault(); VuFind.modal('show'); - var largeSizeUrl = url + '&size=large'; + var largeSizeUrl = url + (size ? '&size=' + size : ''); $.get(largeSizeUrl).done(function() { $('#modal').find('.modal-body').html('<img src="' + largeSizeUrl + '">'); }).fail(function() { @@ -34,7 +34,7 @@ function loadCoverByElement(data, element) { anchor.show(); anchor.attr('href', response.data.url); // finc specific - registerCoverForModal(anchor, response.data.url); + registerCoverForModal(anchor, response.data.url, 'large'); if (data.ariaLabel) { anchor.attr('aria-label', data.ariaLabel); } diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml index 3535d07483a0c1b1c45ab0f0a43d94e86dbd42ab..3eeaf9847cbffaf057de5690c721c4d36458d99d 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml @@ -5,7 +5,7 @@ <?= $this->render('RecordDriver/DefaultRecord/offcanvas-toggler'); ?> <?php $QRCode = $this->record($this->driver)->getQRCode("core"); - $coverDetails = $this->record($this->driver)->getCoverDetails('core', 'medium', $this->record($this->driver)->getThumbnail('large')); + $coverDetails = $this->record($this->driver)->getCoverDetails('core', 'medium', $this->record($this->driver)->getThumbnail('medium')); $cover = $coverDetails['html']; $preview = ($this->previewOverride ?? false) ? $this->previewOverride : $this->record($this->driver)->getPreviews(); diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/cover.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/cover.phtml index 5047db5ac874ef36f95b2b7af1396d8875d2e4b2..09390599e73a8fc87f595aaeefb5de94ce7d866a 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/cover.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/cover.phtml @@ -3,9 +3,9 @@ <?php /* finc: this one is very special, see revisions for context */ /*If you want to load covers in lightbox use '.recordcover'; the class '.nocover' prevents nocover images from loading in lightbox or can be used to hide the images */ ?> -<?php $alt = $alt ?? $this->transEsc('Cover Image')?> <?php $id = $driver->getUniqueID() ?> <?php $title = $this->transEsc($driver->getTitle()); ?> +<?php $alt = $this->transEscAttr('Cover Image') . ' ' . $this->transEscAttr("of") . ' ' . $title;?> <?php if ($id) { @@ -16,39 +16,44 @@ ?> <?php if ($cover): ?> <?php /* load cover directly... */ ?> - <?php if ($this->link): ?><a id="<?=$coverId?>" href="<?=$this->escapeHtmlAttr($this->link)?>" tabindex="-1" aria-hidden="true"><?php endif; ?> - <img alt="<?=$alt?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" src="<?=$this->escapeHtmlAttr($cover); ?>" /> <?php if ($this->link): ?> - </a> - <script> - registerCoverForModal($('#<?=$coverId?>'), '<?=$cover?>'); - </script> + <a + id="<?=$coverId?>" + href="<?=$this->escapeHtmlAttr($this->link)?>" + ariaLabel="<?=$this->transEscAttr('Link-to')?> <?=$this->transEscAttr('Cover Image')?> <?=$this->transEscAttr('of')?> <?=$title?>" + > + <?php endif; ?> + <img alt="<?=$alt?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" src="<?=$this->escapeHtmlAttr(($this->link ?? $cover)); ?>" /> + <?php if ($this->link): ?> + </a> + <script> + registerCoverForModal($('#<?=$coverId?>'), '<?=$cover?>'); + </script> <?php endif; ?> <?php elseif ($cover === false): ?> <img src="<?=$this->url('cover-unavailable')?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="nocover" alt="<?=$this->transEscAttr('No Cover Image')?>" aria-hidden="true" tabindex="-1" /> <?php else: ?> <?php /* load cover by ajax */ ?> <div id="<?=$coverId?>" class="ajaxcover"> - <div class="spinner"><i class="fa fa-spinner fa-spin"></i></div> - <div class="cover-container"> + <div class="spinner"><i class="fa fa-spinner fa-spin"></i></div> + <div class="cover-container"> <?=$this->setIconText = false;?> - <?=$this->render('record/coverReplacement')?> <a class="coverlink hidden" href="javascript:" aria-hidden="true" tabindex="-1"> - <img <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?> class="recordcover ajax" src="<?=$this->imageLink('noCover2.gif')?>" alt="<?=$this->escapeHtmlAttr($alt); ?>" /> + <img <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?> class="recordcover ajax" src="<?=$this->url('cover-unavailable')?>" alt="<?=$this->escapeHtmlAttr($alt); ?>" /> <script> - loadCoverByElement( - { - recordId:'<?=$this->escapeHtmlAttr($driver->getUniqueID())?>', - alt:'<?=$this->transEscAttr('Cover Image')?> <?=$this->transEscAttr("of")?> <?=$title?>', - ariaLabel:'<?=$this->transEscAttr("Link-to")?> <?=$this->transEscAttr('Cover Image')?> <?=$this->transEscAttr("of")?> <?=$title?>', - size:'<?=$this->escapeHtmlAttr($size)?>', - source:'<?=$this->escapeHtmlAttr($driver->getSourceIdentifier())?>' - }, - $('#<?=$coverId?>') - ); + loadCoverByElement( + { + recordId:'<?=$this->escapeHtmlAttr($driver->getUniqueID())?>', + alt:'<?=$alt?>', + ariaLabel:'<?=$this->transEscAttr("Link-to")?> <?=$this->transEscAttr('Cover Image')?> <?=$this->transEscAttr("of")?> <?=$title?>', + size:'<?=$this->escapeHtmlAttr($size)?>', + source:'<?=$this->escapeHtmlAttr($driver->getSourceIdentifier())?>' + }, + $('#<?=$coverId?>') + ); </script> </a> - </div> + </div> </div> <?php endif; ?> <?=$this->record($this->driver)->getRecordIconText()?>