Bugzilla – Attachment 127200 Details for
Bug 29280
Add star ratings to OPAC lists display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29280: Add OpacStarRatings to opac-shelves.tt
Bug-29280-Add-OpacStarRatings-to-opac-shelvestt.patch (text/plain), 6.09 KB, created by
Katrin Fischer
on 2021-11-01 21:18:12 UTC
(
hide
)
Description:
Bug 29280: Add OpacStarRatings to opac-shelves.tt
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-11-01 21:18:12 UTC
Size:
6.09 KB
patch
obsolete
>From 92caea4559a73153e1d882f214a28d7f919546e5 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Tue, 19 Oct 2021 22:51:21 +0000 >Subject: [PATCH] Bug 29280: Add OpacStarRatings to opac-shelves.tt > >To test: >-Apply patch and restart everything >-Set the system preference 'OpacStarRatings' to 'results, detail, lists, and patron' >-Build a public lists with some items that have ratings >-View the list page and you should see the ratings appear >-Make sure that the ratings and the number of votes are acurate >-Ratings on the opac-shelves should look and function just like those on the OPAC results page >-Turn the 'OpacStarRatings' system pref to 'only detials' and 'no', making sure they do not show in the lists display > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/admin/preferences/opac.pref | 2 +- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 26 ++++++++++++++++++++++ > opac/opac-shelves.pl | 11 +++++++++ > 3 files changed, 38 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index c3e793794c..d4d237d938 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -46,7 +46,7 @@ OPAC: > - "Show star-ratings on" > - pref: OpacStarRatings > choices: >- all: "results, details, and patron" >+ all: "results, details, lists, and patron" > disable: "no" > details: "only details" > - "pages." >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 936a178442..e9d2f844a2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -477,6 +477,32 @@ > > [% itemsloo.XSLTBloc | $raw %] > >+ [% IF ( OpacStarRatings == 'all' ) %] >+ <div class="results_summary ratings"> >+ [% SET rating_avg = itemsloo.ratings.get_avg_rating() %] >+ [% rating_avg_int = BLOCK %][% rating_avg | format("%.0f") %][% END %] >+ <div class="br-wrapper br-theme-fontawesome-stars"> >+ <div class="br-widget br-readonly"> >+ [% FOREACH i IN [ 1 2 3 4 5 ] %] >+ [% IF rating_avg_int == i %] >+ <a href="#" class="br-selected br-current"></a> >+ [% ELSIF rating_avg_int > i %] >+ <a href="#" class="br-selected"></a> >+ [% ELSE %] >+ <a href="#"></a> >+ [% END %] >+ [% END %] >+ </div> >+ </div> >+ >+ [% IF itemsloo.ratings.count > 0 %] >+ <span id="rating_total_[% itemsloo.biblionumber | html %]"> ([% itemsloo.ratings.count | html %] votes)</span> >+ [% ELSE %] >+ <br /> >+ [% END %] >+ </div> <!-- / .results_summary --> >+ [% END # / IF OpacStarRatings %] >+ > [% IF ( TagsShowEnabled && itemsloo.TagLoop.size ) %] > <div class="results_summary tags"> > <span class="label">Tags:</span> >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 78ce49da0e..1ae3b3b340 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -43,6 +43,7 @@ use Koha::ItemTypes; > use Koha::Patrons; > use Koha::Virtualshelves; > use Koha::RecordProcessor; >+use Koha::Ratings; > > use constant ANYONE => 2; > >@@ -75,6 +76,10 @@ if( $op eq 'view' || $op eq 'list' ){ > }); > } > >+$template->param( >+ OpacStarRatings => C4::Context->preference("OpacStarRatings") >+); >+ > if (C4::Context->preference("BakerTaylorEnabled")) { > $template->param( > BakerTaylorImageURL => &image_url(), >@@ -352,6 +357,12 @@ if ( $op eq 'view' ) { > }); > } > >+ if ( C4::Context->preference('OpacStarRatings') eq 'all' ) { >+ my $ratings = Koha::Ratings->search({ biblionumber => $this_item->{biblionumber} }); >+ $this_item->{ratings} = $ratings; >+ $this_item->{my_rating} = $loggedinuser ? $ratings->search({ borrowernumber => $loggedinuser })->next : undef; >+ } >+ > my $items = $biblio->items->filter_by_visible_in_opac({ patron => $patron }); > my $allow_onshelf_holds; > while ( my $item = $items->next ) { >-- >2.11.0
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 29280
:
126558
|
126861
|
126899
|
126900
|
127190
| 127200 |
127201
|
127202