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
- #ng_email_field(object_name, method, options = {}) ⇒ Object
- #ng_error_messages_for(object_name, method, options = {}) ⇒ Object
- #ng_form_for(record, options = {}, &block) ⇒ Object
- #ng_form_name(record) ⇒ Object
- #ng_invalid(object_name, options, html_options, &block) ⇒ Object
- #ng_invalid_for(object_name, method, options, html_options, &block) ⇒ Object
- #ng_select(object_name, method, choices = {}, options = {}, html_options = {}) ⇒ Object
- #ng_text_area(object_name, method, options = {}) ⇒ Object
- #ng_text_field(object_name, method, options = {}) ⇒ Object
- #ng_valid(object_name, options, html_options, &block) ⇒ Object
- #ng_valid_for(object_name, method, options, html_options, &block) ⇒ Object
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, = {}) Tags::NgEmailField.new(object_name, method, self, ).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 (object_name, method, = {}) Tags::NgValidationErrors.new(object_name, method, self, ).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, = {}, &block) [:html] ||= {} [:html]['ang-form'] = "" [:html][:name] ||= ng_form_name(record) form_for(record, , &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, , , &block) Tags::NgValid.new(object_name, nil, self, , , '$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, , , &block) Tags::NgValid.new(object_name, method, self, , , '$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 = {}, = {}, = {}) Tags::NgSelect.new(object_name, method, self, choices, , ).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, = {}) Tags::NgTextArea.new(object_name, method, self, ).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, = {}) Tags::NgTextField.new(object_name, method, self, ).render end |