Module: Booties::PopoverHelper

Includes:
Utils
Defined in:
app/helpers/booties/popover_helper.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Utils

merge_classes

Instance Method Details

#popover(text = nil, tag: :a, container: nil, content:, title: nil, placement: nil, trigger: nil, **options, &block) ⇒ Object

rubocop:disable Metrics/MethodLength, Metrics/ParameterLists



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'app/helpers/booties/popover_helper.rb', line 46

def popover(text = nil,
            tag: :a,
            container: nil,
            content:,
            title: nil,
            placement: nil,
            trigger: nil,
            **options,
            &block)
  data = {
    toggle: 'popover',
    content: content,
    container: container,
    placement: placement,
    trigger: trigger,
  }
  options[tag == :button ? :type : :role] ||= 'button'
  options[:title] = title
  options[:tabindex] ||= 10 if trigger
  options[:data] ||= {}
  options[:data].update data

   tag, text, options, &block
end