Module: ButtonHelper
Instance Method Summary
collapse
#parse_content_or_options, #prepend_class, #squeeze_n_strip
Instance Method Details
5
6
7
8
9
10
11
12
13
14
|
# File 'app/helpers/button_helper.rb', line 5
def button(content_or_options=nil, options={}, &block)
content, options = parse_content_or_options(content_or_options, options)
layout = 'btn-block' if options.delete(:layout).try(:to_sym) == :block
size = get_btn_size(options.delete(:size))
type = get_btn_type(options.delete(:type))
prepend_class(options, 'btn', type, size, layout)
content_tag :button, (content.presence || capture(&block)), options
end
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/helpers/button_helper.rb', line 16
def button_group(options={}, &block)
size = get_btn_group_size(options.delete(:size))
layout = if options.delete(:layout).try(:to_sym) == :vertical
'btn-group-vertical'
else
'btn-group'
end
prepend_class(options, layout, size)
options[:role] = 'group'
options[:data] = (options[:data] || {}).merge({bui: 'btn_group', size: size})
content_tag :div, options, &block
end
|
31
32
33
34
35
36
|
# File 'app/helpers/button_helper.rb', line 31
def button_toolbar(options={}, &block)
prepend_class(options, 'btn-toolbar')
options[:role] = 'toolbar'
content_tag :div, options, &block
end
|
38
39
40
41
42
43
|
# File 'app/helpers/button_helper.rb', line 38
def navbar_button(content_or_options=nil, options={}, &block)
content, options = parse_content_or_options(content_or_options, options)
prepend_class(options, 'navbar-btn')
button content, options, &block
end
|