Tag Cloud
Dependency :
compile ":tagcloud:0.3"
Summary
Installation
grails install-plugin tagcloud
Description
Introduction
The plugin provides GSP tag that allow to simple create "tag cloud" in GSP pages. If you use Taggable Plugin, you can display easy tags related to given class. Tag Cloud plugin is based on jquery.tagcloud.js.Tag Cloud depends on jQuery Plugin. If you don't use it in your aplication, will be installed automatically.Generated tag cloud is wrapped in a <div> with a id="tc_tagcloud", so you can style it with css (eg. width).Issue tracker and sources are hosted on github http://github.com/maszkara/grails-tagcloud-pluginUsage
Without Taggable Plugin
Add to your GSP page:<tc:tagCloud tags="${[green: 5, red: 10, blue: 1, black: 24, purple: 17]}" />With Taggable Plugin
If you have in application Domain Class which implements org.grails.taggable.Taggable (from Taggable Plugin):import org.grails.taggable.*class Vehicle implements Taggable { }
<tc:tagCloud bean="${Vehicle}" />Configuration
Attributes which can be used for customize:- tags - map which contains tags (key) and amounts (value)
<tc:tagCloud tags="${[green: 5, red: 10, blue: 1, black: 24, purple: 17]}" />If it is used with bean attribute, tags attribute will be ignored.
- bean - class implements
org.grails.taggable.Taggableinterface. All tags related to this class will be show in tag cloud. - sort - tags will be sorted alphabetically, if set to
true(default:false) - controller - controller which is used to create tag links (default: current controller)
- action - action which is used to create tag links (default: current action)
- paramName - param to which tag will be assigned (default: id)
- id - value which will be assigned to id param
- color - map which contains boundary color values
<tc:tagCloud tags="${[green: 5, red: 10, blue: 1, black: 24, purple: 17]}" color="${[start: '#f00', end: '#00f']}" />
- size - map which contains boundary size values
<tc:tagCloud tags="${[green: 5, red: 10, blue: 1, black: 24, purple: 17]}" size="${[start: 10, end: 40, unit: 'px']}" />
Example
<tc:tagCloud tags="${[green: 5, red: 10, blue: 1, black: 24, purple: 17]}" size="${[start: 10, end: 40, unit: 'px']}" color="${[start: '#f00', end: '#00f']}" controller="tag" action="show" />
<tc:tagCloud tags="${[green: 5, red: 10, blue: 1, black: 24, purple: 17]}" controller="myController" action="myAction" id="5" paramName="myParam" />
<a href="/app-name/myController/myAction/5?myParam=green">green</a><tc:tagCloud tags="${[green: 5, red: 10, blue: 1, black: 24, purple: 17]}" controller="myController" action="myAction" />
<a href="/app-name/myController/myAction/green">green</a>Plugin version history
v.0.3 (2010-03-14)- Plugin is compatible with jQuery Plugin 1.3.2.4 and newer
- Attribute sort added
- Attributes paramName and id added
- jQuery removed from package (it's provided by jQuery plugin)
- Code cleaned
- Rendered tags from Taggable interface or from Map
- configurable look