diff --git a/themes/blueprint/js/preview.js b/themes/blueprint/js/preview.js index 793d225bb4c9bdc0766b4d838077a549f710ff48..e223507704762472c298e08fc2708d6e1cfc581a 100644 --- a/themes/blueprint/js/preview.js +++ b/themes/blueprint/js/preview.js @@ -27,6 +27,13 @@ function getHTPreviews(skeys) { } } +function applyPreviewUrl($link, url) { + $link.attr('href', url).show(); + $link.parents('.result,.record') + .find('img.summcover,img.recordcover') + .parents('a').attr('href', url); +} + function processBookInfo(booksInfo, previewClass) { // assign the correct rights string depending on source var viewOptions = (previewClass == 'previewGBS') @@ -35,8 +42,9 @@ function processBookInfo(booksInfo, previewClass) { var bookInfo = booksInfo[bibkey]; if (bookInfo) { if (viewOptions.indexOf(bookInfo.preview)>= 0) { - var $link = $('.' + previewClass + '.' + bibkey); - $link.attr('href', bookInfo.preview_url).show(); + applyPreviewUrl( + $('.' + previewClass + '.' + bibkey), bookInfo.preview_url + ); } } } @@ -58,7 +66,7 @@ function processHTBookInfo(booksInfo) { for (var i = 0; i < items.length; i++) { // check if items possess an eligible rights code if (getHathiOptions().indexOf(items[i].rightsCode) >= 0) { - $link.attr('href', items[i].itemURL).show(); + applyPreviewUrl($link, items[i].itemURL); } } } diff --git a/themes/blueprint/templates/RecordDriver/SolrDefault/result-list.phtml b/themes/blueprint/templates/RecordDriver/SolrDefault/result-list.phtml index b8588b41752a0bbd882af70e8f9ca1282838e270..8967ca6362d3e1b5a9e9775967e95d6cb2b67fba 100644 --- a/themes/blueprint/templates/RecordDriver/SolrDefault/result-list.phtml +++ b/themes/blueprint/templates/RecordDriver/SolrDefault/result-list.phtml @@ -1,11 +1,13 @@ <div class="result source<?=$this->escapeHtml($this->driver->getResourceSource())?> recordId<?=$this->driver->supportsAjaxStatus()?' ajaxItemId':''?>"> <input type="hidden" value="<?=$this->escapeHtml($this->driver->getUniqueID())?>" class="hiddenId" /> <div class="span-2"> - <? if ($summThumb = $this->record($this->driver)->getThumbnail()): ?> - <img src="<?=$this->escapeHtml($summThumb)?>" class="summcover" alt="<?=$this->transEsc('Cover Image')?>"/> - <? else: ?> - <img src="<?=$this->url('cover-unavailable')?>" class="summcover" alt="<?=$this->transEsc('No Cover Image')?>"/> - <? endif; ?> + <a href="<?=$this->recordLink()->getUrl($this->driver)?>"> + <? if ($summThumb = $this->record($this->driver)->getThumbnail()): ?> + <img src="<?=$this->escapeHtml($summThumb)?>" class="summcover" alt="<?=$this->transEsc('Cover Image')?>"/> + <? else: ?> + <img src="<?=$this->url('cover-unavailable')?>" class="summcover" alt="<?=$this->transEsc('No Cover Image')?>"/> + <? endif; ?> + </a> </div> <div class="span-9"> <div class="resultItemLine1"> diff --git a/themes/bootstrap/js/preview.js b/themes/bootstrap/js/preview.js index 793d225bb4c9bdc0766b4d838077a549f710ff48..c1eed9fd20e0042addaa8d65654670b76a35294b 100644 --- a/themes/bootstrap/js/preview.js +++ b/themes/bootstrap/js/preview.js @@ -27,6 +27,13 @@ function getHTPreviews(skeys) { } } +function applyPreviewUrl($link, url) { + $link.attr('href', url).show(); + $link.parents('.result,.record') + .find('img.img-polaroid') + .parents('a').attr('href', url); +} + function processBookInfo(booksInfo, previewClass) { // assign the correct rights string depending on source var viewOptions = (previewClass == 'previewGBS') @@ -35,8 +42,9 @@ function processBookInfo(booksInfo, previewClass) { var bookInfo = booksInfo[bibkey]; if (bookInfo) { if (viewOptions.indexOf(bookInfo.preview)>= 0) { - var $link = $('.' + previewClass + '.' + bibkey); - $link.attr('href', bookInfo.preview_url).show(); + applyPreviewUrl( + $('.' + previewClass + '.' + bibkey), bookInfo.preview_url + ); } } } @@ -58,7 +66,7 @@ function processHTBookInfo(booksInfo) { for (var i = 0; i < items.length; i++) { // check if items possess an eligible rights code if (getHathiOptions().indexOf(items[i].rightsCode) >= 0) { - $link.attr('href', items[i].itemURL).show(); + applyPreviewUrl($link, items[i].itemURL); } } }