Module: FormHelper
- Defined in:
- app/helpers/form_helper.rb
Instance Method Summary collapse
-
#input_block(options = {}, &block) ⇒ Object
Generates verbose bootstrap wrapper HTML for generic forms Use simple_form_for and it’s helpers for forms focused on records.
Instance Method Details
#input_block(options = {}, &block) ⇒ Object
Generates verbose bootstrap wrapper HTML for generic forms Use simple_form_for and it’s helpers for forms focused on records
Accepts a hash of arguments with the following keys: id: id attribute of the input element (necessary for accessible labels) label: label text
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/form_helper.rb', line 9 def input_block( = {}, &block) label_text = .delete(:label) id = .delete(:id) label = if label_text label_tag(id, label_text, :class => 'control-label') else ActiveSupport::SafeBuffer.new # empty safe string end content_tag(:div, :class => 'control-group') do label << content_tag(:div, :class => 'controls') do capture(&block) end end end |