Bug 38422: Allow plugin cover images in OPAC lists

This patch updates the template to allow cover images from plugins in the OPAC list page. It adds a data-isbn and data-title attribute to the cover images element and also moves the element below the setting of the title so that we can pass that directly.

It also adds the script call to allow the plugin method to work on the page

Test plan:
1) View the patch diff and note that the data attributes have been added correctly
2) View the patch diff and note that the <a> tag has been moved below the setting of the img_title template variable
3) View the patch diff and note that the CoverImagePlugins variable has been set correctly (compare to the intranet file detail.tt for reference if needed)
4) Confirm that no changes have been made to any elements beyond adding the data attributes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-11-12 11:01:57 +00:00 committed by Katrin Fischer
parent 210b93abac
commit 54e393d770
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 9 additions and 6 deletions

View File

@ -3,6 +3,7 @@
[% USE Koha %]
[% USE KohaDates %]
[% USE AdditionalContents %]
[% USE KohaPlugins %]
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% SET LoginEnabled = ( Koha.Preference('opacuserlogin') == 1 ) %]
@ -16,6 +17,7 @@
[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled %]
[% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %]
[% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %]
[% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %]
[% BLOCK delete_shelf %]
<form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="deleteshelf[% shelf.shelfnumber | html %]" class="d-inline">
@ -384,12 +386,12 @@
[% END %]
<td>
<div class="coverimages">
<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber | html %]">
[% IF ( itemsloo.title ) %]
[% img_title = itemsloo.title %]
[% ELSE %]
[% img_title = itemsloo.biblionumber %]
[% END %]
[% IF ( itemsloo.title ) %]
[% img_title = itemsloo.title %]
[% ELSE %]
[% img_title = itemsloo.biblionumber %]
[% END %]
<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber | html %]" data-isbn="[% itemsloo.normalized_isbn | html %]" data-title="[% img_title | html %]">
[% IF ( OPACLocalCoverImages ) %]
<span title="[% img_title | html %]" class="[% itemsloo.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
@ -812,6 +814,7 @@
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% CoverImagePlugins | $raw %]
[% IF OpenLibraryCovers || OpenLibrarySearch %]
[% Asset.js("js/openlibrary.js") | $raw %]
[% END %]