Hey guys. Since this is my first blog, i don’t even know that the subject I’m going to write on is even bloggable. But here I go.
As part of my responsibility in a recent project, I was asked to implement a taglib that could allow a user to rate his likeness for a movie using a rating scale that could use customised images for the rating scale. Most of us have seen such a a rating scale. A typical example would be such a scale.
For this purpose, I created a tag library which had two tags named “resource” and “rating”. The tags are used as follows:
<title>Welcome to Grails</title>
<meta name="layout" content="main" />
- id: The ID of the object to be modified which is passed to the appropriate controller and action
- dynamic: Specifies whether the scale responds to user input, i.e. send the rating to the appropriate action. Defaults to false.
- units: Specifies total number of units out of which the rating is based
- rating: Specifies the current rating of the scale
- controller:Specifies the required controller
- action: Specifies the appropriate action
- overImage: Image to be displayed on mouse hover
- outImage: Image to be displayed when mouse moves out of the rating scale
On clicking on the rating scale, an AJAX call is sent to the appropriate controller and action which updates the rating of the object. This rating is immediately visible on the page without refreshing any page.
Work is still going on and I hope that when it is finished, we’ll have much more options and a more versatile taglib. Till then, take care.