superform 0.5.1 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +131 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +128 -27
- data/README.md +183 -54
- data/SPEC_STYLE_GUIDE.md +146 -0
- data/lib/generators/superform/install/USAGE +6 -2
- data/lib/generators/superform/install/install_generator.rb +11 -22
- data/lib/generators/superform/install/templates/base.rb +33 -0
- data/lib/superform/field.rb +104 -0
- data/lib/superform/form.rb +34 -0
- data/lib/superform/namespace.rb +25 -15
- data/lib/superform/namespace_collection.rb +7 -4
- data/lib/superform/rails/components/base.rb +31 -0
- data/lib/superform/rails/components/button.rb +20 -0
- data/lib/superform/rails/components/checkbox.rb +19 -0
- data/lib/superform/rails/components/field.rb +11 -0
- data/lib/superform/rails/components/input.rb +59 -0
- data/lib/superform/rails/components/label.rb +20 -0
- data/lib/superform/rails/components/select.rb +43 -0
- data/lib/superform/rails/components/textarea.rb +12 -0
- data/lib/superform/rails/field.rb +137 -0
- data/lib/superform/rails/form.rb +129 -0
- data/lib/superform/rails/option_mapper.rb +36 -0
- data/lib/superform/rails/strong_parameters.rb +73 -0
- data/lib/superform/rails.rb +17 -368
- data/lib/superform/version.rb +1 -1
- metadata +21 -13
- data/lib/generators/superform/install/templates/application_form.rb +0 -31
@@ -1,31 +0,0 @@
|
|
1
|
-
class ApplicationForm < Superform::Rails::Form
|
2
|
-
include Phlex::Rails::Helpers::Pluralize
|
3
|
-
|
4
|
-
def row(component)
|
5
|
-
div do
|
6
|
-
render component.field.label(style: "display: block;")
|
7
|
-
render component
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def around_template(&)
|
12
|
-
super do
|
13
|
-
error_messages
|
14
|
-
yield
|
15
|
-
submit
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def error_messages
|
20
|
-
if model.errors.any?
|
21
|
-
div(style: "color: red;") do
|
22
|
-
h2 { "#{pluralize model.errors.count, "error"} prohibited this post from being saved:" }
|
23
|
-
ul do
|
24
|
-
model.errors.each do |error|
|
25
|
-
li { error.full_message }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|