OPACStarRatings already exist on the OPAC details, results, and patron pages. Some librarians would find it handy if they were also included on OPAC lists (opac-shelves.tt)
Created attachment 126558 [details] [review] 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
Although it was introduced for (and named for) user-related pages, the include file user-star-ratings.inc could be used here, I think. Unless the ratings are supposed to display, but not be interacted with? If they are supposed to be interacted with, the template will need to include the relevant JS: [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %] [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %] [% Asset.js("js/ratings.js") | $raw %] [% END %]
(In reply to Owen Leonard from comment #2) > Although it was introduced for (and named for) user-related pages, the > include file user-star-ratings.inc could be used here, I think. Unless the > ratings are supposed to display, but not be interacted with? > > If they are supposed to be interacted with, the template will need to > include the relevant JS: > > [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %] > [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %] > [% Asset.js("js/ratings.js") | $raw %] > [% END %] Thanks for looking at this Owen! I followed the behavior of results.tt, which doesn't seem to allow users to interact with OpacStarRatings, only view them. Do you think we should allow patrons to interact with ratings on both results and lists? (if they are logged in) And if so, should I handle all of that in this bug?
(In reply to Lucas Gass from comment #3) > Thanks for looking at this Owen! I followed the behavior of results.tt, > which doesn't seem to allow users to interact with OpacStarRatings, only > view them. My mistake, I was misremembering. I don't recall if there was any particular reason for it to be like this, but that discussion can happen on a different bug.
The search results page adds this event handler to keep the page from jumping if someone clicks one of the stars: $(".br-readonly a").on("click", function(e){ e.preventDefault(); }); Could you add that to opac-shelves.tt in a follow-up?
Created attachment 126861 [details] [review] Bug 29280: (follow-up) add event handler when clicking on star ratings
Created attachment 126899 [details] [review] 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>
Created attachment 126900 [details] [review] Bug 29280: (follow-up) add event handler when clicking on star ratings Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Sorry, not trying to throw this out, but: +$template->param( + OpacStarRatings => C4::Context->preference("OpacStarRatings") +); + Should we not remove this in favor of using TT in the template?
(In reply to Katrin Fischer from comment #9) > Sorry, not trying to throw this out, but: > > +$template->param( > + OpacStarRatings => C4::Context->preference("OpacStarRatings") > +); > + > > Should we not remove this in favor of using TT in the template? Indeed, we should!
Created attachment 127190 [details] [review] Bug 29280: (follow-up) Move OpacStarRating logic to template
Created attachment 127200 [details] [review] 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>
Created attachment 127201 [details] [review] Bug 29280: (follow-up) add event handler when clicking on star ratings Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 127202 [details] [review] Bug 29280: (follow-up) Move OpacStarRating logic to template Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Code is copy/pasted from somewhere else. I cannot push it like that.
(In reply to Jonathan Druart from comment #15) > Code is copy/pasted from somewhere else. I cannot push it like that. I took most of this code from the OPACStarRatings on the results page. What needs to be amended?
(In reply to Lucas Gass from comment #16) > (In reply to Jonathan Druart from comment #15) > > Code is copy/pasted from somewhere else. I cannot push it like that. Are you asking me to put the repeated code in an include?
(In reply to Lucas Gass from comment #17) > (In reply to Lucas Gass from comment #16) > > (In reply to Jonathan Druart from comment #15) > > > Code is copy/pasted from somewhere else. I cannot push it like that. > > Are you asking me to put the repeated code in an include? Yes, please? It can be done on a separate bug report if you prefer.
(In reply to Jonathan Druart from comment #18) > (In reply to Lucas Gass from comment #17) > > (In reply to Lucas Gass from comment #16) > > > (In reply to Jonathan Druart from comment #15) > > > > Code is copy/pasted from somewhere else. I cannot push it like that. > > > > Are you asking me to put the repeated code in an include? > > Yes, please? It can be done on a separate bug report if you prefer. No need for a separate bug, I will do it on this one!
I filed Bug 29749 to clean up OpacStarRatings a bit. If it is pushed it will make adding OpacStarRatings to lists easier.
How can we move forward here?
Quick note: bug 33953 introduces Koha::Biblio->ratings