Module: Rails::Angulate::Helpers::FormHelper

Extended by:
ActiveSupport::Concern
Included in:
Rails::Angulate::Helpers
Defined in:
lib/rails/angulate/helpers/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#ng_email_field(object_name, method, options = {}) ⇒ Object



24
25
26
# File 'lib/rails/angulate/helpers/form_helper.rb', line 24

def ng_email_field(object_name, method, options = {})
  Tags::NgEmailField.new(object_name, method, self, options).render
end

#ng_error_messages_for(object_name, method, options = {}) ⇒ Object



32
33
34
# File 'lib/rails/angulate/helpers/form_helper.rb', line 32

def ng_error_messages_for(object_name, method, options = {})
  Tags::NgValidationErrors.new(object_name, method, self, options).render
end

#ng_form_for(record, options = {}, &block) ⇒ Object



9
10
11
12
13
14
# File 'lib/rails/angulate/helpers/form_helper.rb', line 9

def ng_form_for(record, options = {}, &block)
  options[:html] ||= {}
  options[:html]['ang-form'] = ""
  options[:html][:name] ||= ng_form_name(record)
  form_for(record, options, &block)
end

#ng_form_name(record) ⇒ Object



52
53
54
# File 'lib/rails/angulate/helpers/form_helper.rb', line 52

def ng_form_name(record)
  "#{object_name_for(record)}_form"
end

#ng_invalid(object_name, options, html_options, &block) ⇒ Object



40
41
42
# File 'lib/rails/angulate/helpers/form_helper.rb', line 40

def ng_invalid(object_name, options, html_options, &block)
  Tags::NgValid.new(object_name, nil, self, options, html_options, '$invalid').render(&block)
end

#ng_invalid_for(object_name, method, options, html_options, &block) ⇒ Object



48
49
50
# File 'lib/rails/angulate/helpers/form_helper.rb', line 48

def ng_invalid_for(object_name, method, options, html_options, &block)
  Tags::NgValid.new(object_name, method, self, options, html_options, '$invalid').render(&block)
end

#ng_select(object_name, method, choices = {}, options = {}, html_options = {}) ⇒ Object



28
29
30
# File 'lib/rails/angulate/helpers/form_helper.rb', line 28

def ng_select(object_name, method, choices = {}, options = {}, html_options = {})
  Tags::NgSelect.new(object_name, method, self, choices, options, html_options).render
end

#ng_text_area(object_name, method, options = {}) ⇒ Object



16
17
18
# File 'lib/rails/angulate/helpers/form_helper.rb', line 16

def ng_text_area(object_name, method, options = {})
  Tags::NgTextArea.new(object_name, method, self, options).render
end

#ng_text_field(object_name, method, options = {}) ⇒ Object



20
21
22
# File 'lib/rails/angulate/helpers/form_helper.rb', line 20

def ng_text_field(object_name, method, options = {})
  Tags::NgTextField.new(object_name, method, self, options).render
end

#ng_valid(object_name, options, html_options, &block) ⇒ Object



36
37
38
# File 'lib/rails/angulate/helpers/form_helper.rb', line 36

def ng_valid(object_name, options, html_options, &block)
  Tags::NgValid.new(object_name, nil, self, options, html_options, '$valid').render(&block)
end

#ng_valid_for(object_name, method, options, html_options, &block) ⇒ Object



44
45
46
# File 'lib/rails/angulate/helpers/form_helper.rb', line 44

def ng_valid_for(object_name, method, options, html_options, &block)
  Tags::NgValid.new(object_name, method, self, options, html_options, '$valid').render(&block)
end