Forum Discussion
Hi Moreno,
I'm not sure what you mean by doing it by hand -- can you post some code to demonstrate? It seems like you should be able to take the average rating and caculate how many stars (out of 5) to give it based on the average. I believe the way the core Lithium product does it out-of-the-box is by rendering different divs for each half-star and then putting different CSS classes on the divs based on whether or not the half star should show as "enabled" or "disabled". You could do something similar, or render your 5-star rating image in a different way (there are many jquery plugins around that can render 5-star ratings).
-Doug
- mfeltscher11 years agoExpert
As of right now I only have a textual representation like this:
<#-- TODO: Display as stars --> <#assign body = "Rating: ${review.reviews.rating.value} / 5" />
No, there is no need to calculate the average rating.
My question is: Is there some core Freemarker function / macro which takes a numeric rating value as a parameter and returns the HTML which is used to display the stars? I'm aware I could just do this by myself by copying / reimplementing the Lithium markup (different divs) but this doesn't seem very future-oriented to me. What if Lithium changes the markup in the future for example?
Thanks,
Moreno
- DougS11 years agoKhoros Oracle
Hi Moreno,
There is unfortunately no ratings-related Freemarker objects right now. At this point I believe you would need to re-build the UI for this yourself (which, like you say, could fall out-of-sync with any future changes Lithium makes).
-Doug
Related Content
- 4 years agoInactive User