Class: Components::Form
Constant Summary
Superform::Rails::Form::Field
Instance Attribute Summary
#model
Instance Method Summary
collapse
#build_field, #form_tag, #initialize, #key, #submit, #view_template
Instance Method Details
#around_template ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/generators/superform/install/templates/base.rb', line 12
def around_template(&)
super do
error_messages
yield if block_given?
submit
end
end
|
#error_messages ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/generators/superform/install/templates/base.rb', line 20
def error_messages
if model.errors.any?
div(style: "color: red;") do
h2 { "#{pluralize model.errors.count, "error"} prohibited this post from being saved:" }
ul do
model.errors.each do |error|
li { error.full_message }
end
end
end
end
end
|
#row(component) ⇒ Object
5
6
7
8
9
10
|
# File 'lib/generators/superform/install/templates/base.rb', line 5
def row(component)
div do
render component.field.label(style: "display: block;")
render component
end
end
|