Module: NfgUi::Bootstrap::Utilities::Tooltipable
- Includes:
- Disableable
- Included in:
- Components::Button, Components::DropdownItem, Components::Elements::Avatar, Components::Elements::Badge, Components::Elements::NavItem, Components::Foundations::Icon, Components::Foundations::Image, Components::Foundations::Typeface, Components::Patterns::Progress
- Defined in:
- lib/nfg_ui/bootstrap/utilities/tooltipable.rb
Overview
-
else
content_tag button.html_wrapper_element, button.html_options do
= button.body
Tooltip placement: You can override the placement if needed by setting the tooltip_placement method in your target class – :top, :bottom, :left, :right
Example:
def tooltip_placement
:right
end
Instance Attribute Summary
Attributes included from Disableable
Instance Method Summary collapse
- #data ⇒ Object
- #disabled_component_tooltip_wrapper_html_options ⇒ Object
-
#html_options ⇒ Object
There are a number of complex changes that need to be made to the html for disabled tooltipped buttons Read more:.
- #tooltip ⇒ Object
Methods included from Disableable
Instance Method Details
#data ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/nfg_ui/bootstrap/utilities/tooltipable.rb', line 62 def data if tooltip disabled ? super : super.merge!(tooltip_data_attributes) else super end end |
#disabled_component_tooltip_wrapper_html_options ⇒ Object
70 71 72 73 74 75 |
# File 'lib/nfg_ui/bootstrap/utilities/tooltipable.rb', line 70 def { data: tooltip_data_attributes, title: tooltip, class: [:block] ? 'd-block' : 'd-inline-block', tabindex: '0' } end |
#html_options ⇒ Object
There are a number of complex changes that need to be made to the html for disabled tooltipped buttons Read more:
getbootstrap.com/docs/4.1/components/tooltips/#disabled-elements
53 54 55 56 57 58 59 60 |
# File 'lib/nfg_ui/bootstrap/utilities/tooltipable.rb', line 53 def return super if [:tooltip].nil? component_title = disabled ? .fetch(:title, nil) : tooltip component_styles = ([:style] || '') + (disabled ? ' pointer-events: none;' : '') if disabled super.merge!(title: component_title, style: component_styles.try(:squish)) end |
#tooltip ⇒ Object
44 45 46 |
# File 'lib/nfg_ui/bootstrap/utilities/tooltipable.rb', line 44 def tooltip .fetch(:tooltip, nil) end |