Class: AngularFormValidation::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
lib/angular_form_validation/form/builder.rb

Constant Summary collapse

FIELD_HELPERS =
%w{color_field date_field datetime_field datetime_local_field
email_field month_field number_field password_field phone_field
range_field search_field telephone_field text_area text_field time_field
url_field week_field}

Instance Method Summary collapse

Instance Method Details

#collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object



37
38
39
40
# File 'lib/angular_form_validation/form/builder.rb', line 37

def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
  html_options.merge!({"ng-model" => "#{@object_name}.#{method.to_s}", "ng-init" => "#{@object_name}.#{method.to_s}='#{@object[method.to_s]}'"})
  super(method, collection, value_method, text_method, options = {}, html_options, &block)
end

#collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object



42
43
44
45
# File 'lib/angular_form_validation/form/builder.rb', line 42

def collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
  html_options.merge!({"ng-model" => "#{@object_name}.#{method.to_s}", "ng-init" => "#{@object_name}.#{method.to_s}='#{@object[method.to_s]}'"})
  super(method, collection, value_method, text_method, options = {}, html_options, &block)
end

#collection_select(method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object



22
23
24
25
# File 'lib/angular_form_validation/form/builder.rb', line 22

def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
  html_options.merge!({"ng-model" => "#{@object_name}.#{method.to_s}", "ng-init" => "#{@object_name}.#{method.to_s}='#{@object[method.to_s]}'"})
  super(method, collection, value_method, text_method, options, html_options)
end

#grouped_collection_select(method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {}) ⇒ Object



27
28
29
30
# File 'lib/angular_form_validation/form/builder.rb', line 27

def grouped_collection_select(method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
  html_options.merge!({"ng-model" => "#{@object_name}.#{method.to_s}", "ng-init" => "#{@object_name}.#{method.to_s}='#{@object[method.to_s]}'"})
  super(method, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options)
end

#submit(value = nil, options = {}) ⇒ Object



17
18
19
20
# File 'lib/angular_form_validation/form/builder.rb', line 17

def submit(value=nil, options={})
  options.merge!({"ng-disabled" =>"#{@options[:html][:method].to_s}#{@template.controller_name.classify}.$invalid"})
  super(value, options)
end

#time_zone_select(method, priority_zones = nil, options = {}, html_options = {}) ⇒ Object



32
33
34
35
# File 'lib/angular_form_validation/form/builder.rb', line 32

def time_zone_select(method, priority_zones = nil, options = {}, html_options = {})
  html_options.merge!({"ng-model" => "#{@object_name}.#{method.to_s}", "ng-init" => "#{@object_name}.#{method.to_s}='#{@object[method.to_s]}'"})
  super(method, priority_zones = nil, options, html_options)
end