Module: ButtonToHelper

Includes:
FormatHelper
Defined in:
app/helpers/button_to_helper.rb

Instance Method Summary collapse

Methods included from FormatHelper

#prepend_class, #squeeze_n_strip

Instance Method Details

#button_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/button_to_helper.rb', line 4

def button_to(name = nil, options = nil, html_options = nil, &block)
  html_options, options = options, name if block_given?
  options      ||= {}
  html_options ||= {}

  layout = 'btn-block' if html_options.delete(:layout).try(:to_sym) == :block
  size   = get_btn_size(html_options.delete(:size))
  style  = get_btn_type(html_options.delete(:style))

  prepend_class(html_options, 'btn', style, layout, size)

  super(name, options, html_options, &block)
end