Module: Golden::Theme::Bootstrap::DropdownHelper

Defined in:
lib/golden/theme/bootstrap/dropdown_helper.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap_dropdown_btn(text, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/golden/theme/bootstrap/dropdown_helper.rb', line 13

def bootstrap_dropdown_btn text, options = {}
  text = text.html_safe << ' '
  text << (:span, nil, class: 'caret')
  options = {
    name: nil,
    type: 'button',
    class: 'btn dropdown-toggle',
    data: { toggle: 'dropdown' }
  }.deep_merge options
  button_tag text, options
end

#bootstrap_dropdown_menu(options = {}, &block) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/golden/theme/bootstrap/dropdown_helper.rb', line 25

def bootstrap_dropdown_menu options = {}, &block
  options = {
    role: 'menu',
    class: 'dropdown-menu'
  }.deep_merge options
  bootstrap_ul_tag options, &block
end

#bootstrap_dropdown_toggle(text, url = '', options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/golden/theme/bootstrap/dropdown_helper.rb', line 3

def bootstrap_dropdown_toggle text, url = '', options = {}
  text = text.html_safe << ' '
  text << (:span, nil, class: 'caret')
  options = {
    class: 'dropdown-toggle',
    data: { toggle: 'dropdown' }
  }.deep_merge options
  link_to text, url, options
end