Class RacingOnRails::FormBuilder
In: app/helpers/racing_on_rails/form_builder.rb
Parent: ActionView::Helpers::FormBuilder

Label + form fields HTML. Wrap checkboxes in divs (probably should do this for all label + field chunks).

Methods

Public Instance methods

Set editable to false for read-only

[Source]

    # File app/helpers/racing_on_rails/form_builder.rb, line 36
36:     def labelled_check_box(method, text = nil, check_box_options = {})
37:       label_options = check_box_options.delete(:label) || {}
38:       if check_box_options[:editable] == false
39:         %Q{#{label(method, "#{text || method.to_s.titleize}", label_options)} <div class="labelled" id="#{object_name}_#{method}">#{@object.send(method)}</div>}
40:       else
41:         %Q{<div class="check_box"><div class="input">#{check_box(method, check_box_options)}</div><div  class="label">#{label(method, text || method.to_s.titleize)}</div></div>}
42:       end
43:     end

List from Countries::COUNTRIES

[Source]

    # File app/helpers/racing_on_rails/form_builder.rb, line 26
26:     def labelled_country_select(method, options = {})
27:       labelled_select method, RacingAssociation.current.priority_country_options + Countries::COUNTRIES, options.merge(:label => { :text => "Country" })
28:     end

[Source]

    # File app/helpers/racing_on_rails/form_builder.rb, line 30
30:     def labelled_password_field(method, text = method.to_s.titleize, password_field_options = {})
31:       label_options = password_field_options.delete(:label) || {}
32:       %Q{#{label(method, "#{text}", label_options)} #{password_field(method, password_field_options)}}
33:     end

[Source]

    # File app/helpers/racing_on_rails/form_builder.rb, line 45
45:     def labelled_radio_button(method, value, text = nil)
46:       %Q{<div class="radio">#{radio_button(method, value)}#{label(method, text || method.to_s.titleize)}</div>}
47:     end

Set editable to false for read-only

[Source]

    # File app/helpers/racing_on_rails/form_builder.rb, line 15
15:     def labelled_select(method, select_options, options = {})
16:       label_options = options.delete(:label) || {}
17:       text = label_options.delete(:text) if label_options
18:       if options[:editable] == false
19:         %Q{#{label(method, "#{text || method.to_s.titleize}", label_options)} <div class="labelled" id="#{object_name}_#{method}">#{@object.send(method)}</div>}
20:       else
21:         %Q{#{label(method, "#{text || method.to_s.titleize}", label_options)} #{select(method, select_options, options)}}
22:       end
23:     end

[Source]

    # File app/helpers/racing_on_rails/form_builder.rb, line 60
60:     def labelled_text(method, text = nil, label_text = nil, label_options = {})
61:       %Q{#{label(method, "#{label_text || method.to_s.titleize}", label_options)} <div class="labelled" id="#{object_name}_#{method}">#{text || @object.send(method)}</div>}
62:     end

Set editable to false for read-only

[Source]

    # File app/helpers/racing_on_rails/form_builder.rb, line 50
50:     def labelled_text_area(method, options = {})
51:       label_options = options.delete(:label) || {}
52:       text = label_options[:text] if label_options
53:       if options[:editable] == false
54:         %Q{#{label(method, "#{text || method.to_s.titleize}", :class => 'text_area')} <div class="labelled" id="#{object_name}_#{method}">#{@object.send(method)}</div>}
55:       else
56:         %Q{#{label(method, "#{text || method.to_s.titleize}", :class => 'text_area')}#{text_area(method, options)}}
57:       end
58:     end

Set editable to false for read-only

[Source]

    # File app/helpers/racing_on_rails/form_builder.rb, line 5
 5:     def labelled_text_field(method, text = method.to_s.titleize, text_field_options = {})
 6:       label_options = text_field_options.delete(:label) || {}
 7:       if text_field_options[:editable] == false
 8:         %Q{#{label(method, "#{text || method.to_s.titleize}", label_options)} <div class="labelled" id="#{object_name}_#{method}">#{@object.send(method)}</div>}
 9:       else
10:         %Q{#{label(method, "#{text || method.to_s.titleize}", label_options)} #{text_field(method, text_field_options)}}
11:       end
12:     end

[Validate]