Module: HelpfulFields::FormBuilder

Defined in:
lib/helpful_fields.rb

Instance Method Summary collapse

Instance Method Details

#check_box_with_label(field, label, options = {}) ⇒ Object



69
70
71
# File 'lib/helpful_fields.rb', line 69

def check_box_with_label(field, label, options={})
  check_box(field, :id => options[:id]) + label(field, label, :for => options[:id])
end

#radio_button_with_label(field, value, label, options = {}) ⇒ Object



73
74
75
76
77
78
79
80
# File 'lib/helpful_fields.rb', line 73

def radio_button_with_label(field, value, label, options={})
  unless id = options[:id]
    object_s, fields_s, value_s = [@object_name, field, value].map{|f| @template.send(:sanitize_to_id, f) }
    id = "#{object_s}_#{fields_s}_#{value_s}"
  end

  radio_button(field, value, :id => id) + label('_', label, :for => id)
end