Class: FormtasticBootstrap::Inputs::BooleanInput
- Inherits:
-
Formtastic::Inputs::BooleanInput
- Object
- Formtastic::Inputs::BooleanInput
- FormtasticBootstrap::Inputs::BooleanInput
show all
- Includes:
- Base
- Defined in:
- lib/formtastic-bootstrap/inputs/boolean_input.rb
Instance Method Summary
collapse
#add_on_content, #add_on_wrapper_classes, #bootstrap_wrapping, #form_group_wrapping, #input_content, #prepended_or_appended?
#label_html, #label_html_options
#hint_html
#error_first_html, #error_html, #error_list_html, #error_none_html, #error_sentence_html
#form_control_input_html_options, #input_html_options
Instance Method Details
#checkbox_wrapping(&block) ⇒ Object
27
28
29
30
31
32
|
# File 'lib/formtastic-bootstrap/inputs/boolean_input.rb', line 27
def checkbox_wrapping(&block)
template.content_tag(:div,
template.capture(&block).html_safe,
wrapper_html_options
)
end
|
#hidden_field_html ⇒ Object
15
16
17
|
# File 'lib/formtastic-bootstrap/inputs/boolean_input.rb', line 15
def hidden_field_html
template.hidden_field_tag(input_html_options[:name], unchecked_value, :id => nil, :disabled => input_html_options[:disabled] )
end
|
#label_with_nested_checkbox ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/formtastic-bootstrap/inputs/boolean_input.rb', line 19
def label_with_nested_checkbox
builder.label(
method,
label_text_with_embedded_checkbox,
label_html_options
)
end
|
#to_html ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/formtastic-bootstrap/inputs/boolean_input.rb', line 7
def to_html
checkbox_wrapping do
hidden_field_html <<
"".html_safe <<
[label_with_nested_checkbox, hint_html].join("\n").html_safe
end
end
|
#wrapper_html_options ⇒ Object
34
35
36
37
38
|
# File 'lib/formtastic-bootstrap/inputs/boolean_input.rb', line 34
def wrapper_html_options
super.tap do |options|
options[:class] = (options[:class].split - ["form-group"] + ["checkbox"]).join(" ")
end
end
|