Module: Bh::Helpers::Tooltips

Included in:
Bh::Helpers
Defined in:
lib/bh/helpers/tooltips.rb

Overview

The words an element says on hover, which Bootstrap wires nowhere on its own.

Instance Method Summary collapse

Instance Method Details

#tooltip_data(title, placement: nil) ⇒ Hash

What an element carries to be given a tooltip: the controller that makes one, and what it says. bs_title is the name Bootstrap's own tooltip reads.

Parameters:

  • title (String)

    the words the tooltip says.

  • placement (String, nil) (defaults to: nil)

    which side of the element it opens on.

Returns:

  • (Hash)

    the data an element wearing a tooltip takes.



10
11
12
# File 'lib/bh/helpers/tooltips.rb', line 10

def tooltip_data(title, placement: nil)
  { controller: 'tooltip', bs_placement: placement, bs_title: title }.compact
end