Bugzilla – Attachment 125196 Details for
Bug 24454
currency formatting from JS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28854: Add bundle content display to OPAC
Bug-28854-Add-bundle-content-display-to-OPAC.patch (text/plain), 6.65 KB, created by
Martin Renvoize (ashimema)
on 2021-09-23 14:39:17 UTC
(
hide
)
Description:
Bug 28854: Add bundle content display to OPAC
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-09-23 14:39:17 UTC
Size:
6.65 KB
patch
obsolete
>From bf34087d7b27fc150131f3a5e97b1ffbb35a9480 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 23 Sep 2021 15:08:55 +0100 >Subject: [PATCH] Bug 28854: Add bundle content display to OPAC > >TODO: Switch to /public api route >TODO: Move expand button to right like staff client > >https://bugs.koha-community.org/show_bug.cgi?id=24454 >--- > .../bootstrap/en/modules/opac-detail.tt | 92 ++++++++++++++++++- > opac/opac-detail.pl | 10 ++ > 2 files changed, 100 insertions(+), 2 deletions(-) > >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 ce9bff3939e..6733e7227a8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1066,7 +1066,9 @@ > <caption class="sr-only">Holdings</caption> > <thead> > <tr> >- >+ [% IF ( itemdata_bundles ) %] >+ <th id="item_bundle" data-colname="item_bundle"></th> >+ [% END %] > [% IF Koha.Preference('OPACLocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %] > <th id="item_cover" data-colname="item_cover">Cover image</th> > [% END %] >@@ -1116,7 +1118,17 @@ > </thead> > <tbody> > [% FOREACH ITEM_RESULT IN items %] >- <tr vocab="http://schema.org/" typeof="Offer"> >+ <tr vocab="http://schema.org/" typeof="Offer" data-itemnumber="[% ITEM_RESULT.itemnumber | html %]"> >+ >+ [% IF ( itemdata_bundles ) %] >+ [% IF ITEM_RESULT.is_bundle %] >+ <td class="details-control"> >+ <button><i class="fa fa-folder-open"></i></button> >+ </td> >+ [% ELSE %] >+ <td></td> >+ [% END %] >+ [% END %] > > [% IF Koha.Preference('OPACLocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %] > <td class="cover"> >@@ -1419,6 +1431,82 @@ > "autoWidth": false > }, columns_settings); > >+ function createChild ( row, itemnumber ) { >+ // This is the table we'll convert into a DataTable >+ var bundles_table = $('<table class="display" width="100%"/>'); >+ >+ // Display it the child row >+ row.child( bundles_table ).show(); >+ >+ // Initialise as a DataTable >+ var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?"; >+ var bundle_table = bundles_table.api({ >+ "ajax": { >+ "url": bundle_table_url >+ }, >+ "header_filter": false, >+ "embed": [ >+ "biblio", >+ "checkout" >+ ], >+ "order": [[ 0, "asc" ]], >+ "columns": [ >+ { >+ "data": "item_type", >+ "title": "Item Type", >+ "searchable": false, >+ "orderable": true, >+ }, >+ { >+ "data": "biblio.title", >+ "title": "Title", >+ "searchable": true, >+ "orderable": true, >+ }, >+ { >+ "data": "damaged_status", >+ "title": "Status", >+ "searchable": false, >+ "orderable": true, >+ }, >+ { >+ "data": "external_id", >+ "title": "Barcode", >+ "searchable": true, >+ "orderable": true, >+ }, >+ { >+ "data": "callnumber", >+ "title": "Callnumber", >+ "searchable": true, >+ "orderable": true, >+ }, >+ ] >+ }, [], 1); >+ >+ return; >+ } >+ >+ // Add event listener for opening and closing details >+ $('#holdingst tbody').on('click', 'td.details-control', function () { >+ var tr = $(this).closest('tr'); >+ var dTable = $(this).closest('table').DataTable({ 'retrieve': true }); >+ >+ var itemnumber = tr.data('itemnumber'); >+ var row = dTable.row( tr ); >+ >+ if ( row.child.isShown() ) { >+ // This row is already open - close it >+ row.child.hide(); >+ tr.removeClass('shown'); >+ } >+ else { >+ // Open this row >+ createChild(row, itemnumber); >+ tr.addClass('shown'); >+ } >+ } ); >+ > var serial_column_settings = [% TablesSettings.GetColumns( 'opac', 'biblio-detail', 'subscriptionst', 'json' ) | $raw %]; > > KohaTable("#subscriptionst", { >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index a9eb913f003..9af79f21760 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -752,6 +752,15 @@ if ( not $viewallitems and @items > $max_items_to_display ) { > $itm->{cover_images} = $item->cover_images; > } > >+ if ($item->is_bundle) { >+ $itemfields{bundles} = 1; >+ $itm->{is_bundle} = 1; >+ } >+ >+ if ($item->in_bundle) { >+ $itm->{bundle_host} = $item->bundle_host; >+ } >+ > my $itembranch = $itm->{$separatebranch}; > if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { > if ($itembranch and $itembranch eq $currentbranch) { >@@ -802,6 +811,7 @@ if( C4::Context->preference('ArticleRequests') ) { > MARCNOTES => $marcnotesarray, > norequests => $norequests, > RequestOnOpac => C4::Context->preference("RequestOnOpac"), >+ itemdata_bundles => $itemfields{bundles}, > itemdata_ccode => $itemfields{ccode}, > itemdata_materials => $itemfields{materials}, > itemdata_enumchron => $itemfields{enumchron}, >-- >2.20.1
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 24454
:
97573
|
98228
|
125193
|
125194
|
125195
|
125196
|
125197
|
125198
|
125199