Module: SimpleFormExtension::Components::Popovers

Defined in:
lib/simple_form_extension/components/popovers.rb

Instance Method Summary collapse

Instance Method Details

#popover(wrapper_options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/simple_form_extension/components/popovers.rb', line 5

def popover(wrapper_options)
  return nil unless options[:popover]

  options = { 
    class: 'btn-popover fa fa-question-circle',
    :rel => 'popover',
    :'data-toggle' => 'popover',
    :'data-container' => 'body',
    :'data-title' => popover_title,
    :'data-content' => popover_content,
    :'data-placement' => popover_position,
    :'data-trigger' => popover_tigger
  }
  
  template.(:i, '', options)
end

#popover_contentObject



27
28
29
# File 'lib/simple_form_extension/components/popovers.rb', line 27

def popover_content
  popover_options[:content]
end

#popover_positionObject



31
32
33
# File 'lib/simple_form_extension/components/popovers.rb', line 31

def popover_position
  popover_options[:position] ||= "auto"
end

#popover_tiggerObject



35
36
37
# File 'lib/simple_form_extension/components/popovers.rb', line 35

def popover_tigger
  popover_options[:trigger] ||= "click"
end

#popover_titleObject



23
24
25
# File 'lib/simple_form_extension/components/popovers.rb', line 23

def popover_title
  popover_options[:title]
end