Rateable Plugin
Dependency :
compile ":rateable:0.7.1"Custom repositories :
mavenRepo "http://localhost:8081/artifactory/plugins-releases-local/"
Summary
A plugin that adds a generic mechanism for rating domain objects.
Description
Rateable Plugin
This plugin provides allows ratings to be attached to domain objects, as well as a 5-star rating component with ajax update.Requirements
- Grails Version: 1.1 and above
- JDK: 1.5 and above
- YUI 2.6.1
Installation
grails install-plugin rateable
Usage
Implement theRateable interface:import org.grails.rateable.*class Vehicle implements Rateable { }
<rateable:resources/>
<rateable:ratings bean='${myVehicle}'/>grails.rateable.rater.evaluator = { request.user }grails.rateable.rater.evaluatorr = { session.user }Static Methods
- listOrderByAverageRating - lists all rated items by their average rating. Takes an optional Map parameter for pagination
- countRated - Counts the number of rated items, good for pagination in combination with the above method.
Properties
- ratings - Returns all the ratings for a given Rateable
- averageRating - Returns the average rating of all the ratings
- totalRatings - Returns the total number of ratings given to the Rateable
Methods
- rate(user, Double rating) - Rates a Rateable for the given user and specified rating
- userRating(user) - Returns the rating for the specified user