Class: FoundationRailsHelper::FormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- FoundationRailsHelper::FormBuilder
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/foundation_rails_helper/form_builder.rb
Instance Method Summary collapse
- #autocomplete(attribute, url, options = {}) ⇒ Object
- #check_box(attribute, options = {}, checked_value = "1", unchecked_value = "0") ⇒ 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
62 63 64 65 66 67 68 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 62 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 = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 16 def check_box(attribute, = {}, checked_value = "1", unchecked_value = "0") custom_label(attribute, [:label], [:label_options]) do .delete(:label) .delete(:label_options) super(attribute, , checked_value, unchecked_value) end + error_and_hint(attribute, ) end |
#date_select(attribute, options = {}, html_options = {}) ⇒ Object
43 44 45 46 47 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 43 def date_select(attribute, = {}, = {}) field attribute, do || super(attribute, , .merge(:autocomplete => :off)) end end |
#datetime_select(attribute, options = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 37 def datetime_select(attribute, = {}) field attribute, do || super(attribute, {}, .merge(:autocomplete => :off)) end end |
#password_field(attribute, options = {}) ⇒ Object
31 32 33 34 35 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 31 def password_field(attribute, = {}) field attribute, do || super(attribute, .merge(:autocomplete => :off)) end end |
#radio_button(attribute, tag_value, options = {}) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 24 def (attribute, tag_value, = {}) [:for] ||= "#{object.class.to_s.downcase}_#{attribute}_#{tag_value}" c = super(attribute, tag_value, ) l = label(attribute, .delete(:text), ) l.gsub(/(for=\"\w*\"\>)/, "\\1#{c} ").html_safe end |
#select(attribute, choices, options = {}, html_options = {}) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 55 def select(attribute, choices, = {}, = {}) field attribute, do || [:autocomplete] ||= :off super(attribute, choices, , ) end end |
#submit(value = nil, options = {}) ⇒ Object
70 71 72 73 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 70 def submit(value=nil, ={}) [:class] ||= "small radius success button" super(value, ) end |
#time_zone_select(attribute, options = {}) ⇒ Object
49 50 51 52 53 |
# File 'lib/foundation_rails_helper/form_builder.rb', line 49 def time_zone_select(attribute, = {}) field attribute, do || super(attribute, {}, .merge(:autocomplete => :off)) end end |