Bug 37515: Add common class to all places where an item type image is shown

This patch adds an "itemtype-image" class to templates in all places
where we show itemtype images. This patch affects both the OPAC and the
staff client.

To test you should have icons associated with multiple item types.

- Apply the patch and go to Administration -> System preferences
- Search for "itemtype"
  - noItemTypeImages should be set to "Show"
  - OpacNoItemTypeImages should be set to "Show"
  - BiblioItemtypeInfo should be set to "Show"
- Search for "usercss"
  - Add an obvious style rule for item type images to IntranetUserCSS
    and OPACUserCSS, e.g.

    .itemtype-image { border: 3px solid orange; }

- In the staff interface, check the following pages to confirm that your
  custom style is visible:

  - Administration -> Item types
    -> Edit
  - Administration -> Authorized values -> CCODE -> Edit a CCODE
  - Advanced search
    - Search results
    - Bibliographic details
  - Place hold
  - Lists -> List contents view (must set the item-level_itypes
    preference to "bibliographic record")

- In the OPAC:
  - Advanced search
    - Search results
      - Bibliographic details
  - Place hold
  - Log in as a user with checkouts ->
    - View the checkouts tab on the patron summary page
  - Lists -> List contents view (must set the item-level_itypes
    preference to "bibliographic record")

Sponsored-by: Athens County Public Libraries
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2024-07-29 18:28:00 +00:00 committed by Katrin Fischer
parent 8f0dc36f0d
commit 6bf3bd942f
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
15 changed files with 23 additions and 23 deletions

View file

@ -48,7 +48,7 @@
[% FOREACH image IN imageset.images %]
<label>
[% IF image.StaffImageUrl %]
<img src="[% image.StaffImageUrl | html %]" alt="[% image.StaffImageUrl | html %]" title="[% image.StaffImageUrl | html %]" />
<img class="itemtype-image" src="[% image.StaffImageUrl | html %]" alt="[% image.StaffImageUrl | html %]" title="[% image.StaffImageUrl | html %]" />
[% END %]
[% IF image.checked %]
<input type="radio" name="image" value="[% image.KohaImage | html %]" checked="checked" />

View file

@ -341,7 +341,7 @@
[% UNLESS noItemTypeImages %]
let image_location = item_type_image_locations[row.item_type_id];
node += image_location
? '<img src="%s" alt="%s" title="%s" /> '.format(escape_str(image_location), escape_str(item_type_description), escape_str(item_type_description))
? '<img class="itemtype-image" src="%s" alt="%s" title="%s" /> '.format(escape_str(image_location), escape_str(item_type_description), escape_str(item_type_description))
: '';
[% END %]
node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description));

View file

@ -307,7 +307,7 @@
<td>[% loo.lib | html %]</td>
<td>[% loo.lib_opac | html %]</td>
<td>
[% IF ( loo.image ) %]<img src="[% loo.image | url %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
[% IF ( loo.image ) %]<img class="itemtype-image" src="[% loo.image | url %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
<td>
[% IF loo.branches.size > 0 %]
[% branches_str = "" %]

View file

@ -368,7 +368,7 @@
<th scope="row">Image</th>
<td>
[% SET image_location = itemtype.image_location('intranet') %]
[% IF image_location %]<img src="[% image_location | html %]" alt="" />[% END %]
[% IF image_location %]<img class="itemtype-image" src="[% image_location | html %]" alt="" />[% END %]
</td>
</tr>
[% END %]
@ -414,7 +414,7 @@
[% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
<td>
[% SET image_location = itemtype.image_location('intranet') %]
[% IF image_location %]<img src="[% image_location | html %]" alt="" />[% ELSE %]&nbsp;[% END %]
[% IF image_location %]<img class="itemtype-image" src="[% image_location | html %]" alt="" />[% ELSE %]&nbsp;[% END %]
</td>
[% END %]
<td>

View file

@ -247,7 +247,7 @@
<label for="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]">
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
[% IF ( itemtypeloo.imageurl ) %]
<img src="[% itemtypeloo.imageurl | html %]" alt="[% itemtypeloo.description | html %]" />
<img class="itemtype-image" src="[% itemtypeloo.imageurl | html %]" alt="[% itemtypeloo.description | html %]" />
[% END %]
&nbsp;
[% END %]

View file

@ -152,11 +152,11 @@
<span class="label">MARC framework:</span>
<span class="frameworkcode">[% Frameworks.GetName(biblio.frameworkcode) | html %]</span>
</span>
[% IF !item_level_itypes || Koha.Preference("BiblioItemtypeInfo") %]
[% IF !item_level_itypes || Koha.Preference("BiblioItemtypeInfo") %]
<span class="results_summary itemtype">
<span class="label">Itemtype:</span>
[% IF ( !noItemTypeImages && imageurl ) %]
<img src="[% imageurl | html %]" alt="" />
<img class="itemtype-image" src="[% imageurl | html %]" alt="" />
[% END %]
[% IF ( description ) %]
<span class="itypetext">[% description | html %]</span>

View file

@ -545,7 +545,7 @@
[% IF ( !item_level_itypes ) || Koha.Preference('BiblioItemtypeInfo') %]
<div class="result-biblio-itemtype">
[% IF !noItemTypeImages && SEARCH_RESULT.imageurl %]
<img src="[% SEARCH_RESULT.imageurl | html %]" alt="[% SEARCH_RESULT.description | html %]" />
<img class="itemtype-image" src="[% SEARCH_RESULT.imageurl | html %]" alt="[% SEARCH_RESULT.description | html %]" />
[% END %]
<span class="itypetext">[% SEARCH_RESULT.description | html %]</span>
</div>
@ -633,7 +633,7 @@
[% FOREACH items_loo IN SEARCH_RESULT.${items_loop} %]
[% IF item_level_itypes && !noItemTypeImages && items_loo.imageurl %]
<li class="result_itype_image [% items_loo.branchcode | html %]">
<img src="[% items_loo.imageurl | html %]" title="[% items_loo.description | html %]" alt="[% items_loo.description | html %]" />
<img class="itemtype-image" src="[% items_loo.imageurl | html %]" title="[% items_loo.description | html %]" alt="[% items_loo.description | html %]" />
[% ELSE %]
<li class="[% items_loo.branchcode | html %]">
[% END %]

View file

@ -421,7 +421,7 @@
</td>
[% UNLESS Koha.Preference('item-level_itypes') %]
<td>
<img src="[% biblioloo.itemtype.image_location| html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
<img class="itemtype-image" src="[% biblioloo.itemtype.image_location| html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
</td>
[% END %]
<td>[% biblioloo.rank | html %]</td>
@ -926,7 +926,7 @@
[% IF Koha.Preference('item-level_itypes') %]
<td>
[% UNLESS ( noItemTypeImages ) %]
[% IF ( itemloo.itemtype.image_location) %]<img src="[% itemloo.itemtype.image_location | html %]" alt="" /> <br /> [% END %]
[% IF ( itemloo.itemtype.image_location) %]<img class="itemtype-image" src="[% itemloo.itemtype.image_location | html %]" alt="" /> <br /> [% END %]
[% END %]
<span class="itypetext">[% itemloo.itemtype.translated_description | html %]</span>
</td>

View file

@ -327,7 +327,7 @@
[% UNLESS ( item_level_itypes ) %]
<td>
[% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]
<img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
<img class="itemtype-image" src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
[% END %]
<span class="itypetext">[% itemsloo.description | html %]</span>
</td>

View file

@ -186,7 +186,7 @@
<label for="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]">
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages')) %]
[% IF ( itemtypeloo.imageurl ) %]
<img src="[% itemtypeloo.imageurl | html %]" alt="[% itemtypeloo.description | html %]" />
<img class="itemtype-image" src="[% itemtypeloo.imageurl | html %]" alt="[% itemtypeloo.description | html %]" />
[% END %]
&nbsp;
[% END %]

View file

@ -166,7 +166,7 @@
[% IF ( !item_level_itypes || Koha.Preference('BiblioItemtypeInfo') ) %]
<span class="results_summary itemtype"><span class="label">Item type: </span>
[% IF ( imageurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
<img src="[% imageurl | html %]" alt="" />
<img class="itemtype-image" src="[% imageurl | html %]" alt="" />
[% END %]
[% IF ( description ) %]
<span class="itypetext">[% description | html %]</span>
@ -1249,7 +1249,7 @@
<td class="itype">
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
[% IF ( ITEM_RESULT.imageurl ) %]
<img src="[% ITEM_RESULT.imageurl | html %]" title="[% ITEM_RESULT.description | html %]" alt="[% ITEM_RESULT.description | html %]" />
<img class="itemtype-image" src="[% ITEM_RESULT.imageurl | html %]" title="[% ITEM_RESULT.description | html %]" alt="[% ITEM_RESULT.description | html %]" />
[% END %]
[% END %]
<span class="itypetext">[% ITEM_RESULT.description | html %]</span>

View file

@ -244,7 +244,7 @@
[% UNLESS ( item_level_itypes ) %]
<li class="itype">
<span class="label">Item type: </span>
[% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl | html %]" alt="" />[% END %]
[% IF ( bibitemloo.imageurl ) %]<img class="itemtype-image" src="[% bibitemloo.imageurl | html %]" alt="" />[% END %]
<span class="itypetext">[% bibitemloo.translated_description | html %]</span>
</li>
[% END %]
@ -435,7 +435,7 @@
<td class="itype">
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
[% IF ( itemLoo.imageurl ) %]
<img src="[% itemLoo.imageurl | html %]" alt="" />
<img class="itemtype-image" src="[% itemLoo.imageurl | html %]" alt="" />
[% END %]
[% END %]
<span class="itypetext">[% itemLoo.translated_description | html %]</span>

View file

@ -244,7 +244,7 @@
[% # Cell 3: Show item type image %]
<td class="itypecol">
[% IF ( SEARCH_RESULT.imageurl ) %]
<img src="[% SEARCH_RESULT.imageurl | html %]" title="[% SEARCH_RESULT.description | html %]" alt="[% SEARCH_RESULT.description | html %]" />
<img class="itemtype-image" src="[% SEARCH_RESULT.imageurl | html %]" title="[% SEARCH_RESULT.description | html %]" alt="[% SEARCH_RESULT.description | html %]" />
[% END %]
[% IF ( SEARCH_RESULT.score_avg ) %]
<img src="[% themelang | html %]/../images/bonus.png" title="bonus" style="max-height: 35px;"/>

View file

@ -377,7 +377,7 @@
[% UNLESS ( item_level_itypes ) %]
<td>
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
<img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
<img class="itemtype-image" src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
[% END %]
<span class="itypetext">[% itemsloo.description | html %]</span>
</td>

View file

@ -335,7 +335,7 @@
<th class="all anti-the">Title</th>
<th>Author</th>
<th class="psort">Due</th>
[% UNLESS ( item_level_itypes ) %]
[% IF ( Koha.Preference('BiblioItemtypeInfo') || !item_level_itypes ) %]
<th>Item type</th>
[% END %]
[% IF ( show_barcode ) %]
@ -426,11 +426,11 @@
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</td>
[% END %]
[% UNLESS ( item_level_itypes ) %]
[% IF ( Koha.Preference('BiblioItemtypeInfo') || !item_level_itypes ) %]
<td class="itype">
<span class="tdlabel">Item type:</span>
[% IF ( ISSUE.imageurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
<img src="[% ISSUE.imageurl | html %]" title="[% ISSUE.description | html %]" alt="[% ISSUE.description | html %]" />
<img class="itemtype-image" src="[% ISSUE.imageurl | html %]" title="[% ISSUE.description | html %]" alt="[% ISSUE.description | html %]" />
[% END %] <span class="itypetext">[% ISSUE.description | html %]</span>
</td>
[% END %]