Bug 40482: Add useful data-attributes to cover image containers on OPAC/staff search results

This patch adds useful data-attributes to the bookcover/bookcoverimg
container in the OPAC/staff search results.

To test:
0. APPLY PATCH
1. Turn on at least 1 image service for both the OPAC and staff interface
2. Do a search that returns results
3. You should see the following data attributes, even when no cover
   image is supplied:

  data-biblionumber
  data-itemtype
  data-itemtype_description
  data-title
  data-subtitle
  data-author
  data-isbn

You can now target these with just CSS.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0e0c150303)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Lucas Gass 2025-07-23 16:54:17 +00:00 committed by Paul Derscheid
parent b394efcd90
commit d69271f3fa
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
2 changed files with 22 additions and 2 deletions

View File

@ -5,6 +5,7 @@
[% USE Biblio %]
[% USE KohaDates %]
[% USE KohaPlugins %]
[% USE ItemTypes %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% SET CoverImagePlugins = KohaPlugins.get_plugins_intranet_cover_images %]
@ -584,7 +585,16 @@
[% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
<tr id="row[% SEARCH_RESULT.biblionumber | html %]">
[% IF ( CoverImagePlugins || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
<td class="bookcoverimg">
<td
class="bookcoverimg"
data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]"
data-itemtype="[% SEARCH_RESULT.itemtype | html %]"
data-itemtype_description="[% ItemTypes.GetDescription(SEARCH_RESULT.itemtype) | html %]"
data-title="[% SEARCH_RESULT.itemtype | html %]"
data-subtitle="[% SEARCH_RESULT.itemtype | html %]"
data-author="[% SEARCH_RESULT.itemtype | html %]"
data-isbn="[% SEARCH_RESULT.normalized_isbn | $raw %]"
>
<div
id="cover-slides-[% SEARCH_RESULT.biblionumber | html %]"
class="cover-slides"

View File

@ -1,5 +1,15 @@
[% USE raw %]
<div class="bookcover">
[% USE ItemTypes %]
<div
class="bookcover"
data-itemtype="[% SEARCH_RESULT.itemtype | html %]"
data-itemtype_description="[% ItemTypes.GetDescription(SEARCH_RESULT.itemtype) | html %]"
data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]"
data-title="[% SEARCH_RESULT.title | html %]"
data-subtitle="[% SEARCH_RESULT.subtitle | html %]"
data-author="[% SEARCH_RESULT.author | html %]"
data-isbn="[% SEARCH_RESULT.normalized_isbn | html %]"
>
<div
class="cover-slider cover-slides itemtype_[% SEARCH_RESULT.itemtype | html %]"
data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]"