Bug 10659

Summary: Upgrade jQuery star ratings plugin
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: bibliwho, dilan, jonathan.druart, martin.renvoize, mtj, nick, pierre-marc.thibault
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11873
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 11969, 22432    
Attachments: Bug 10659: Upgrade jQuery star ratings plugin
Bug 10659: (follow-up) Compiled CSS
Bug 10659: (follow-up) Add plugin information to the about page
Bug 10659: Upgrade jQuery star ratings plugin
Bug 10659: (follow-up) Add plugin information to the about page
Bug 10659: (follow-up) Compiled CSS
Bug 10659: Upgrade jQuery star ratings plugin
Bug 10659: (follow-up) Add plugin information to the about page
Bug 10659: Upgrade jQuery star ratings plugin
Bug 10659: Upgrade jQuery star ratings plugin
Bug 10659: Upgrade jQuery star ratings plugin
Bug 10659: Upgrade jQuery star ratings plugin
Bug 10659: (follow-up) Ensure zero rating shows correctly
Bug 10659: Upgrade jQuery star ratings plugin
Bug 10659: (follow-up) Ensure zero rating shows correctly

Description Owen Leonard 2013-07-29 16:30:23 UTC
The version of the jQuery star ratings plugin that Koha uses is not compatible with the latest version of jQuery. If we want to be able to upgrade jQuery we need to also upgrade the star ratings plugin, which is now at version 4.11 (we have v3.14).
Comment 1 Owen Leonard 2014-02-07 16:06:36 UTC
Although the star ratings plugin site (http://www.fyneworks.com/jquery/star-rating/) says "Compatible with jQuery 1.3+ and the latest 1.9" it in fact requires at minimum jQuery 1.8.
Comment 2 Owen Leonard 2016-03-21 18:43:25 UTC
I notice the plugin hasn't been updated for three years. We might want to consider alternatives in case new versions of jQuery cause it to break.
Comment 3 Owen Leonard 2016-05-31 12:39:23 UTC
We should consider looking for an upgrade or replacement which would fix Bug 11827.
Comment 4 Mason James 2016-06-01 06:58:26 UTC
(In reply to Owen Leonard from comment #3)
> We should consider looking for an upgrade or replacement which would fix Bug
> 11827.

Hi Owen, this one looks quite good...
 http://antenna.io/demo/jquery-bar-rating/examples/

I did spot this list too...
 https://www.sitepoint.com/10-jquery-rating-plugins/
Comment 5 Owen Leonard 2018-06-13 18:41:19 UTC
(In reply to Mason James from comment #4)
> Hi Owen, this one looks quite good...
>  http://antenna.io/demo/jquery-bar-rating/examples/

I'm working on a solution now that uses this.
Comment 6 Owen Leonard 2018-06-14 13:09:17 UTC Comment hidden (obsolete)
Comment 7 Owen Leonard 2018-06-14 13:09:20 UTC Comment hidden (obsolete)
Comment 8 Owen Leonard 2018-06-14 13:25:09 UTC Comment hidden (obsolete)
Comment 9 Owen Leonard 2018-06-27 13:10:15 UTC Comment hidden (obsolete)
Comment 10 Owen Leonard 2018-06-27 13:10:18 UTC Comment hidden (obsolete)
Comment 11 Owen Leonard 2018-06-27 13:10:21 UTC Comment hidden (obsolete)
Comment 12 Dilan Johnpullé 2018-07-04 01:04:34 UTC Comment hidden (obsolete)
Comment 13 Owen Leonard 2018-07-17 12:36:41 UTC
With compiled OPAC CSS files, they will always conflict. I'm not sure why we even add them to the bug report. Exclude the last patch when applying, and then run the command to compile the LESS to CSS:

https://wiki.koha-community.org/wiki/Working_with_Bootstrap_OPAC_LESS_files
Comment 14 Owen Leonard 2018-08-13 13:13:37 UTC Comment hidden (obsolete)
Comment 15 Owen Leonard 2018-08-13 13:13:41 UTC Comment hidden (obsolete)
Comment 16 Cab Vinton 2018-08-30 04:25:50 UTC Comment hidden (obsolete)
Comment 17 Owen Leonard 2018-11-29 18:24:22 UTC Comment hidden (obsolete)
Comment 18 Owen Leonard 2018-12-03 16:10:09 UTC
Created attachment 82826 [details] [review]
Bug 10659: Upgrade jQuery star ratings plugin

This patch replaces our current jQuery star ratings plugin with a newer
plugin which will be compatible with newer versions of jQuery:

http://antenna.io/demo/jquery-bar-rating/examples/

To test you should have one or more records in your catalog with star
ratings.

- Apply the patch and set the OpacStarRatings system preference
  to "results and details"
- Perform a search in the catalog which will return one or more titles
  which have ratings.
  - Confirm that the ratings appear correctly and the ratings are
    read-only.
- Open the "normal" detail page for that record.
  - Confirm that the star rating appears correctly.
  - Test setting and re-setting your star rating. Confirm that it is
    saved.
  - Confirm that the "cancel rating" link appears when you have a rating
    set, and that it disappears after you click it.
- Test that the "only details" and disabled options of the
  OpacStarRatings preference work as they should.
- Confirm that information about the plugin appears on the About page in
  the staff client, replacing the old star ratings plugin information.
Comment 19 Owen Leonard 2019-02-04 14:30:42 UTC
Created attachment 84706 [details] [review]
Bug 10659: Upgrade jQuery star ratings plugin

This patch replaces our current jQuery star ratings plugin with a newer
plugin which will be compatible with newer versions of jQuery:

http://antenna.io/demo/jquery-bar-rating/examples/

To test you should have one or more records in your catalog with star
ratings.

- Apply the patch and set the OpacStarRatings system preference
  to "results and details"
- Perform a search in the catalog which will return one or more titles
  which have ratings.
  - Confirm that the ratings appear correctly and the ratings are
    read-only.
- Open the "normal" detail page for that record.
  - Confirm that the star rating appears correctly.
  - Test setting and re-setting your star rating. Confirm that it is
    saved.
  - Confirm that the "cancel rating" link appears when you have a rating
    set, and that it disappears after you click it.
- Test that the "only details" and disabled options of the
  OpacStarRatings preference work as they should.
- Confirm that information about the plugin appears on the About page in
  the staff client, replacing the old star ratings plugin information.
Comment 20 Pierre-Marc Thibault 2019-02-08 20:37:59 UTC
When I apply the patch, the stars are gone and I have this instead :
"Your rating: 3.[X] Cancel rating. Average rating: 3.0 (1 votes)".
Am I supposed to see stars again?
Comment 21 Pierre-Marc Thibault 2019-02-08 20:40:49 UTC
Nevermind, just forget I have to call yarn build... I shall continue to check this out.
Comment 22 Pierre-Marc Thibault 2019-02-08 20:56:27 UTC
Created attachment 84903 [details] [review]
Bug 10659: Upgrade jQuery star ratings plugin

This patch replaces our current jQuery star ratings plugin with a newer
plugin which will be compatible with newer versions of jQuery:

http://antenna.io/demo/jquery-bar-rating/examples/

To test you should have one or more records in your catalog with star
ratings.

- Apply the patch and set the OpacStarRatings system preference
  to "results and details"
- Perform a search in the catalog which will return one or more titles
  which have ratings.
  - Confirm that the ratings appear correctly and the ratings are
    read-only.
- Open the "normal" detail page for that record.
  - Confirm that the star rating appears correctly.
  - Test setting and re-setting your star rating. Confirm that it is
    saved.
  - Confirm that the "cancel rating" link appears when you have a rating
    set, and that it disappears after you click it.
- Test that the "only details" and disabled options of the
  OpacStarRatings preference work as they should.
- Confirm that information about the plugin appears on the About page in
  the staff client, replacing the old star ratings plugin information.

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Comment 23 Katrin Fischer 2019-02-09 19:42:12 UTC
Hi Owen, this seems to work well overall, but there is one little change to before: When a record has no ratings yet, on the detail page one star shows in yellow by default. Could we change that to be zero stars as before?

Stars seem a little bit bigger than before (but nicer icons).
Comment 24 Owen Leonard 2019-02-11 13:38:47 UTC
Created attachment 84970 [details] [review]
Bug 10659: (follow-up) Ensure zero rating shows correctly

This patch makes a minor markup addition to ensure that a title with no
rating shows no stars.

Also changed: Minor addition to search results JS to prevent unwanted
scrolling if the user clicks a star in a star rating.
Comment 25 Katrin Fischer 2019-02-12 07:01:22 UTC
Created attachment 85010 [details] [review]
Bug 10659: Upgrade jQuery star ratings plugin

This patch replaces our current jQuery star ratings plugin with a newer
plugin which will be compatible with newer versions of jQuery:

http://antenna.io/demo/jquery-bar-rating/examples/

To test you should have one or more records in your catalog with star
ratings.

- Apply the patch and set the OpacStarRatings system preference
  to "results and details"
- Perform a search in the catalog which will return one or more titles
  which have ratings.
  - Confirm that the ratings appear correctly and the ratings are
    read-only.
- Open the "normal" detail page for that record.
  - Confirm that the star rating appears correctly.
  - Test setting and re-setting your star rating. Confirm that it is
    saved.
  - Confirm that the "cancel rating" link appears when you have a rating
    set, and that it disappears after you click it.
- Test that the "only details" and disabled options of the
  OpacStarRatings preference work as they should.
- Confirm that information about the plugin appears on the About page in
  the staff client, replacing the old star ratings plugin information.

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Comment 26 Katrin Fischer 2019-02-12 07:01:26 UTC
Created attachment 85011 [details] [review]
Bug 10659: (follow-up) Ensure zero rating shows correctly

This patch makes a minor markup addition to ensure that a title with no
rating shows no stars.

Also changed: Minor addition to search results JS to prevent unwanted
scrolling if the user clicks a star in a star rating.
Comment 27 Nick Clemens (kidclamp) 2019-02-15 18:45:24 UTC
Awesome work all!

Pushed to master for 19.05
Comment 28 Martin Renvoize (ashimema) 2019-02-25 13:37:02 UTC
Enhancement, will not be backported to 18.11.x series.
Comment 29 Jonathan Druart 2019-02-26 21:47:52 UTC
I am getting the following line in the Koha logs on hitting opac-search.pl, I guess it comes from here.

File not found : lib/jquery/plugins/jquery.rating.js at /home/vagrant/kohaclone/Koha/Template/Plugin/Asset.pm line 83.
Comment 30 Owen Leonard 2019-02-28 13:27:04 UTC
> File not found : lib/jquery/plugins/jquery.rating.js at
> /home/vagrant/kohaclone/Koha/Template/Plugin/Asset.pm line 83.

I have submitted Bug 22432 for this.