Module: BootstrapConcerns::ComponentsHelper

Defined in:
lib/bootstrap_concerns/components_helper.rb

Instance Method Summary collapse

Instance Method Details

#bs_button_to(name = nil, options = nil, html_options = nil) ⇒ Object



3
4
5
# File 'lib/bootstrap_concerns/components_helper.rb', line 3

def bs_button_to(name = nil, options = nil, html_options = nil, &)
  bs_link_or_button_to(:button_to, name, options, html_options, &)
end


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bootstrap_concerns/components_helper.rb', line 11

def bs_link_or_button_to(method_name, name, options, html_options, &)
  normalized_html_options =
    if block_given?
      options ||= {}
    else
      html_options ||= {}
    end

  normalized_html_options.merge!(Option.options_with_button_class(normalized_html_options))

  public_send(
    method_name,
    name,
    options,
    html_options,
    &
  )
end


7
8
9
# File 'lib/bootstrap_concerns/components_helper.rb', line 7

def bs_link_to(name = nil, options = nil, html_options = nil, &)
  bs_link_or_button_to(:link_to, name, options, html_options, &)
end

#flash_alert_color(key) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/bootstrap_concerns/components_helper.rb', line 30

def flash_alert_color(key)
  case key.to_s
  when "notice"
    "success"
  when "alert"
    "danger"
  else
    key
  end
end