Plugins You can find out about all the publicly available Grails plugins.

Likeable Plugin

  • Tags: like, rateable
  • Latest: 0.4.0
  • Last Updated: 03 October 2015
  • Grails version: 2.3 > *
0 vote
Dependency:
compile "org.grails.plugins:likeable:0.4.0"

 Documentation  Source  Issues

Summary

Adds like functionality to domain classes. A light version of Rateable plugin

Installation

compile ':likeable:0.1.2'

Description

To use the plugin, you should define user evaluator and user's Class in grails-app/conf/Config.groovy:
grails.plugin.likeable.liker.evaluator = { request.user }
grails.plugin.likeable.liker.className = 'foo.bar.User'
To add like functionality to domain type, you should implement the Likeable interface:
import ru.jconsulting.likeable.Likeable
class Post implements Likeable {
}
After implementing marker interface domain's metaClass will gain likeable methods:
  • like(user) - adds a like by provided user, or remove existing
  • userLike(user) - returns Like instance if user liked the Likeable, or null otherwise
  • userLiked(user) - returns true if user liked the Likeable, or false otherwise
  • getTotalLikes() - returns likes count for the Likeable