superform 0.5.0 → 0.6.0
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 +131 -29
- data/README.md +200 -66
- 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/dom.rb +51 -0
- data/lib/superform/field.rb +121 -0
- data/lib/superform/field_collection.rb +33 -0
- data/lib/superform/form.rb +34 -0
- data/lib/superform/namespace.rb +134 -0
- data/lib/superform/namespace_collection.rb +51 -0
- data/lib/superform/node.rb +12 -0
- 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/form.rb +240 -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
- data/lib/superform.rb +3 -294
- metadata +25 -9
- data/lib/generators/superform/install/templates/application_form.rb +0 -31
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: phlex-rails
|
@@ -16,14 +15,14 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
18
|
+
version: '2.0'
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
25
|
+
version: '2.0'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: zeitwerk
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,11 +53,30 @@ files:
|
|
54
53
|
- LICENSE.txt
|
55
54
|
- README.md
|
56
55
|
- Rakefile
|
56
|
+
- SPEC_STYLE_GUIDE.md
|
57
57
|
- lib/generators/superform/install/USAGE
|
58
58
|
- lib/generators/superform/install/install_generator.rb
|
59
|
-
- lib/generators/superform/install/templates/
|
59
|
+
- lib/generators/superform/install/templates/base.rb
|
60
60
|
- lib/superform.rb
|
61
|
+
- lib/superform/dom.rb
|
62
|
+
- lib/superform/field.rb
|
63
|
+
- lib/superform/field_collection.rb
|
64
|
+
- lib/superform/form.rb
|
65
|
+
- lib/superform/namespace.rb
|
66
|
+
- lib/superform/namespace_collection.rb
|
67
|
+
- lib/superform/node.rb
|
61
68
|
- lib/superform/rails.rb
|
69
|
+
- lib/superform/rails/components/base.rb
|
70
|
+
- lib/superform/rails/components/button.rb
|
71
|
+
- lib/superform/rails/components/checkbox.rb
|
72
|
+
- lib/superform/rails/components/field.rb
|
73
|
+
- lib/superform/rails/components/input.rb
|
74
|
+
- lib/superform/rails/components/label.rb
|
75
|
+
- lib/superform/rails/components/select.rb
|
76
|
+
- lib/superform/rails/components/textarea.rb
|
77
|
+
- lib/superform/rails/form.rb
|
78
|
+
- lib/superform/rails/option_mapper.rb
|
79
|
+
- lib/superform/rails/strong_parameters.rb
|
62
80
|
- lib/superform/version.rb
|
63
81
|
- sig/superform.rbs
|
64
82
|
homepage: https://github.com/rubymonolith/superform
|
@@ -69,7 +87,6 @@ metadata:
|
|
69
87
|
homepage_uri: https://github.com/rubymonolith/superform
|
70
88
|
source_code_uri: https://github.com/rubymonolith/superform
|
71
89
|
changelog_uri: https://github.com/rubymonolith/superform
|
72
|
-
post_install_message:
|
73
90
|
rdoc_options: []
|
74
91
|
require_paths:
|
75
92
|
- lib
|
@@ -84,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
101
|
- !ruby/object:Gem::Version
|
85
102
|
version: '0'
|
86
103
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
88
|
-
signing_key:
|
104
|
+
rubygems_version: 3.6.7
|
89
105
|
specification_version: 4
|
90
106
|
summary: Build forms in Rails
|
91
107
|
test_files: []
|
@@ -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
|