Tooltip Plugin

8 votes
Dependency:
compile ":tooltip:0.8"

 Documentation  Source  Issues

Summary

This plugin provides a lightweight and lightning fast tooltip that is very easy to use.

Installation

Add the following to your grails-app/conf/BuildConfig.groovy

grails.project.dependency.resolution = {
  plugins {
    compile ':tooltip:0.8'
  }
}

Description

Set default CSS

As of version 0.7 it is possible to change the default CSS file by adding the following line into the application configuration file.

tooltip.defaultStyle="myTooltipStyles"

In this example the application then will reference to a CSS file with the path: css/tooltip/myTooltipStyles.css

Include resources

To include all needed resources to your page simply put the following line into the GSPs html header.

<tooltip:resources/>

When you want to use your own stylesheet add the attribute stylesheet .

<tooltip:resources stylesheet="myTooltipStyles"/>

Note that there is no .css file ending. The root path to the stylesheet path is <app-home>/web-app/css/tooltip

Apply tooltip

You have to surround a text or element with the <tooltip:tip> tag to bring up the tooltip. Have a look at the following example.

<tooltip:tip value="some tooltip text">
    element that shows the tooltip
</tooltip:tip>

Since version 0.2 there is a better i18n support. Just use the code attribute instead of the value attribute. In the next example the tip-tag will invoke the g.message(code:'some.code') method internally.

<tooltip:tip code="some.code">
    element that shows the tooltip
</tooltip:tip>

You can also apply a tooltip with the plain javascript that is generated by the tip-tag. Just have a look at the following example.

<tr onmouseover="tooltip.show('some tooltip text');" onmouseout="tooltip.hide();">
    <td>some</td>
    <td>data</td>
</tr>

Revision

05 Oct 2013, Version 0.8 - Upgrade to Grails 2.0. code or value attribute nomore mandatory.
05 Mar 2012, Version 0.7 - Grails 2.0 compatibility check. Default tooltip CSS configurable.
16 Mar 2010, Version 0.6 - Grails upgrade
13 Dec 2009, Version 0.5 - Licence changed to Apache 2.0, Grails upgrade
01 Jun 2009, Version 0.4 - Grails upgrade
29 Mar 2009, Version 0.3 - Bugfix, Custom stylesheets
08 Mar 2009, Version 0.2 - I18n support
01 Mar 2009, Version 0.1 - Initial release