Class: ApplicationForm
- Inherits:
-
Protoform::Rails::Form
- Object
- Component
- Protoform::Rails::Form
- ApplicationForm
- Includes:
- Phlex::Rails::Helpers::Pluralize
- Defined in:
- lib/generators/protoform/install/templates/application_form.rb
Instance Method Summary collapse
- #around_template(&block) ⇒ Object
- #error_messages ⇒ Object
-
#row(component) ⇒ Object
These are the current dry-initializer options for the base class:.
Methods inherited from Protoform::Rails::Form
#assign, #collection, #field, #form_tag, #key, #namespace, #serialize, #submit, #view_template
Instance Method Details
#around_template(&block) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/generators/protoform/install/templates/application_form.rb', line 23 def around_template(&block) super do yield submit end end |
#error_messages ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/generators/protoform/install/templates/application_form.rb', line 31 def return if model.errors.none? div(style: "color: red;") do h2 do "#{pluralize model.errors.count, "error"} prohibited this post from being saved:" end ul do model.errors.each do |error| li { error. } end end end end |
#row(component) ⇒ Object
These are the current dry-initializer options for the base class:
param :model, reader: false option :helpers, reader: false, default: -> {} option :action, reader: false, default: -> {} option :method, reader: false, default: -> {} option :namespace, reader: false, default: -> do
Namespace.root(key, object: @model, field_class: self.class::Field)
end
16 17 18 19 20 21 |
# File 'lib/generators/protoform/install/templates/application_form.rb', line 16 def row(component) div do render component.field.label(style: "display: block;") render component end end |