AwesomeTooltip

Build Status Maintainability

Lightwer get for loading tooltips on your page without preloading this data on page. With this gem you can load static template and templates with data from database.

Installation

Add this line to your application's Gemfile:

gem 'awesome_tooltip'

And then execute:

$ bundle

Or install it yourself as:

$ gem install awesome_tooltip

Configuration

Mount AwesomeTooltip routes in to your config/routes.rb

mount AwesomeTooltip::Engine => '/', as: 'awesome_tooltip'

Require AwesomeTooltip javascript in to your application.js

//= require awesome_tooltip/tootlip

If you are using Rails 6 with webpack you must create folder javascripts with file application.js in your assets folder and require javascript there.

Require AwesomeTooltip styles

/*
 *= require awesome_tooltip/tooltip
 */

Create folder for you tooltip templates

$ mkdir app/awesome_tooltips

And now just add template.

$ touch app/awesome_tooltips/template.html.erb

Also you can update js configurations

AwesomeTooltip({
  tooltipPath: '/your/custom/path/',
  delay: 2000,
  location: 'bottom'
});
Option Default value Type
tooltipPath /tooltip/ String
hideDelay 1500 Integer
location top(also available bottom) String

Usage

To start using AwesomeTooltip add following attributes to HTML element

<div class="awesome_tooltip" 
     data-template="user_template"
     data-object="user-1"
     data-location="bottom">John Doe</div>

Also you can use static templates

Option Description Value example Optional
data-template Path to your template(root dir for template is app/awesome_tooltips) project false
data-object Model name and object id separated by dash project-1 true
data-location Tooltip location bottom true

TODO:

  • Add generators
  • Add configs
  • Add ability to place tooltip on the left and right side

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.