Class: FoundationRailsHelperMod::FormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- FoundationRailsHelperMod::FormBuilder
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/foundation_rails_helper_mod/form_builder.rb
Instance Method Summary collapse
- #autocomplete(attribute, url, options = {}) ⇒ Object
- #check_box(attribute, options = {}) ⇒ Object
- #date_select(attribute, options = {}, html_options = {}) ⇒ Object
- #datetime_select(attribute, options = {}) ⇒ Object
- #password_field(attribute, options = {}) ⇒ Object
- #radio_button(attribute, tag_value, options = {}) ⇒ Object
- #select(attribute, choices, options = {}, html_options = {}) ⇒ Object
- #submit(value = nil, options = {}) ⇒ Object
- #time_zone_select(attribute, options = {}) ⇒ Object
Instance Method Details
#autocomplete(attribute, url, options = {}) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 66 def autocomplete(attribute, url, = {}) field attribute, do || autocomplete_field(attribute, url, .merge(:update_elements => [:update_elements], :min_length => 0, :value => object.send(attribute))) end end |
#check_box(attribute, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 17 def check_box(attribute, = {}) html = custom_label(attribute, [:label], [:label_options]) do .delete(:label) .delete(:label_options) super(attribute, ) end html += content_tag(:p, [:description], :class => 'description') if [:description].present? html += error_and_hint(attribute, ) end |
#date_select(attribute, options = {}, html_options = {}) ⇒ Object
47 48 49 50 51 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 47 def date_select(attribute, = {}, = {}) field attribute, do || super(attribute, , .merge(:autocomplete => :off)) end end |
#datetime_select(attribute, options = {}) ⇒ Object
41 42 43 44 45 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 41 def datetime_select(attribute, = {}) field attribute, do || super(attribute, {}, .merge(:autocomplete => :off)) end end |
#password_field(attribute, options = {}) ⇒ Object
35 36 37 38 39 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 35 def password_field(attribute, = {}) field attribute, do || super(attribute, .merge(:autocomplete => :off)) end end |
#radio_button(attribute, tag_value, options = {}) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 28 def (attribute, tag_value, = {}) [:for] ||= "#{object.class.to_s.downcase}_#{attribute}_#{tag_value}" l = label(attribute, ) c = super(attribute, tag_value, ) l.gsub(/(for=\"\w*\"\>)/, "\\1#{c} ").html_safe end |
#select(attribute, choices, options = {}, html_options = {}) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 59 def select(attribute, choices, = {}, = {}) field attribute, do || [:autocomplete] ||= :off super(attribute, choices, , ) end end |
#submit(value = nil, options = {}) ⇒ Object
74 75 76 77 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 74 def submit(value=nil, ={}) [:class] ||= "small radius success button" super(value, ) end |
#time_zone_select(attribute, options = {}) ⇒ Object
53 54 55 56 57 |
# File 'lib/foundation_rails_helper_mod/form_builder.rb', line 53 def time_zone_select(attribute, = {}) field attribute, do || super(attribute, {}, .merge(:autocomplete => :off)) end end |