Bugzilla – Attachment 171024 Details for
Bug 37830
Provide ability to filter holdings in OPAC holdings table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37830: Add ability to filter holdings in OPAC
Bug-37830-Add-ability-to-filter-holdings-in-OPAC.patch (text/plain), 2.58 KB, created by
Pedro Amorim
on 2024-09-04 13:06:28 UTC
(
hide
)
Description:
Bug 37830: Add ability to filter holdings in OPAC
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-09-04 13:06:28 UTC
Size:
2.58 KB
patch
obsolete
>From e26a7c59401421d50078508b64bf4e4061dc059e Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Wed, 4 Sep 2024 13:05:17 +0000 >Subject: [PATCH] Bug 37830: Add ability to filter holdings in OPAC > >Test plan: >1) Visit any OPAC biblio page, ktd: >opac_url/cgi-bin/koha/opac-detail.pl?biblionumber=336 >2) Notice a new "Search holdings" input on top of the holdings table >3) Type something in the input, notice it filters rows >4) Clear the filter, notice all rows show >--- > .../bootstrap/en/modules/opac-detail.tt | 23 +++++++++++++++++++ > 1 file changed, 23 insertions(+) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index 03acede510..2e3fef2a7b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -530,6 +530,7 @@ > [% END # / IF serialcollection %] > > [% WRAPPER tab_panel tabname="holdings" %] >+ <input style="margin-bottom:10px; "type="text" placeholder="Search holdings" id="holdings_search_input"> > [% IF too_many_items %] > <p>This record has many physical items ([% items_count | html %]). <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | uri %]&viewallitems=1">View all the physical items.</a></p> > [% ELSIF ( itemloop.size ) %] >@@ -2047,6 +2048,28 @@ > $("#libraryInfoModalLabel, #libraryInfo").html(""); > $("#libraryInfoLink").attr("href", ""); > }); >+ >+ // Search holdings rows: >+ const elsTr = $("#holdingst tbody tr"); >+ const elSearch = $("#holdings_search_input"); >+ const regEsc = (v) => v.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); >+ >+ const filterRows = (evt) => { >+ const val = evt.currentTarget.value.trim(); // Trim from whitespaces >+ const reg = new RegExp(regEsc(val), "i"); // "i" = case insensitive >+ >+ $.each(elsTr, function(index, elTr) { >+ if(!reg.test(elTr.textContent)){ >+ $(elTr).addClass('d-none'); >+ }else{ >+ $(elTr).removeClass('d-none'); >+ } >+ }); >+ }; >+ >+ $('#holdings_search_input').on('input',function(e){ >+ filterRows(e); >+ }); > }); > > function showBsTab( container, panelid ){ >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37830
:
171024
|
171031
|
172450