module Bootstrap4RailsComponents::Bootstrap::Utilities::Tooltipable
Tooltip placement: You can override the placement if needed by setting the tooltip_placement
method in your target class – :top, :bottom, :left, :right
Example:
:right
end
Public Instance Methods
data()
click to toggle source
Calls superclass method
# File lib/bootstrap4_rails_components/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()
click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/utilities/tooltipable.rb, line 70 def disabled_component_tooltip_wrapper_html_options { data: tooltip_data_attributes, title: tooltip, class: 'd-inline-block', tabindex: '0' } end
html_options()
click to toggle source
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
Calls superclass method
# File lib/bootstrap4_rails_components/bootstrap/utilities/tooltipable.rb, line 53 def html_options return super if options[:tooltip].nil? component_title = disabled ? options.fetch(:title, nil) : tooltip component_styles = (options[:style] || '') + (disabled ? ' pointer-events: none;' : '') if disabled super.merge!(title: component_title, style: component_styles.try(:squish)) end
tooltip()
click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/utilities/tooltipable.rb, line 44 def tooltip options.fetch(:tooltip, nil) end
Private Instance Methods
non_html_attribute_options()
click to toggle source
Calls superclass method
Bootstrap4RailsComponents::Bootstrap::Utilities::Disableable#non_html_attribute_options
# File lib/bootstrap4_rails_components/bootstrap/utilities/tooltipable.rb, line 85 def non_html_attribute_options super.push(:tooltip) end
tooltip_data_attributes()
click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/utilities/tooltipable.rb, line 79 def tooltip_data_attributes { toggle: 'tooltip', placement: tooltip_placement, html: 'true' } end
tooltip_placement()
click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/utilities/tooltipable.rb, line 89 def tooltip_placement @tooltip_placement ||= :top end