Forum Discussion
Hello,
Currently there is no way to directly parameterize the ratings.widget.rating-enum-display component for a specific Question. This component will attempt to get the object it is rating from its context. If used in the context of a Question component, then it will give the me too rating to the Question. If not used within a component that has a "ratable object" then it will attempt to get of the ratable item from the URL. Since you plan to use this on the Q&A main page, there will not be an ID for a Question in the URL path, and there is no simple way to add one that will be picked up by this component.
I think a good improvement for the existing component would be to allow the parameterization of the ratable object. You might consider submitting this as an Idea or as a services engagement. Otherwise I think you would need to try and replicate the functionality using the REST API.
Hello Adam,
Thank you very much for these precisions ! I think I will indeed submit an Idea to make this "Me Too" a little bit more reusable.
In the meantime as you suggested, I think I will have to replicate the behaviour by hand, that is, redirect to the login page if the user is not connected (with a fallback_url), and make a rest call to add a Me Too if the user is already logged in.
That said, and juste to be sure, is the correct API call the one i suggested earlier, i.e. :
rest("/messages/id/MESSAGE_ID/ratings/key/question_metoo/ratings/add?rating.value=0.0")
?
Thanks again for your help :)
Related Content
- 4 years agoInactive User
- 5 months ago