superform 0.4.2 → 0.4.4
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/Gemfile.lock +5 -4
- data/lib/superform/rails.rb +17 -0
- data/lib/superform/version.rb +1 -1
- data/lib/superform.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2db21420ecfac1a9133026933f8b05a9a7512bbc35c60ebf605abe88eda05d5b
|
|
4
|
+
data.tar.gz: 33761bcb89952fc6926f4ef798bb3c6665d2b4ce4528b7f451e58a103f9014bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77158970877d1a26538636bb30a4c1949c35d69058e0576bed151f3fb3aa18bc7503a2a1ed6ee7651cc28bdf29244f74a3e15197fe4599cdde4096da8cfb1c90
|
|
7
|
+
data.tar.gz: 6edc1b33b36048b6d3be87eb860b4b7e96595bcda869fa57e5dad390a18e2f8bf7498b75fd46449ce156a85d3f15c606be2856ae725edfa0a1444ddb1915591d
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
superform (0.4.
|
|
4
|
+
superform (0.4.4)
|
|
5
5
|
phlex-rails (~> 1.0)
|
|
6
6
|
zeitwerk (~> 2.6)
|
|
7
7
|
|
|
@@ -118,6 +118,7 @@ GEM
|
|
|
118
118
|
marcel (1.0.2)
|
|
119
119
|
method_source (1.0.0)
|
|
120
120
|
mini_mime (1.1.2)
|
|
121
|
+
mini_portile2 (2.8.5)
|
|
121
122
|
minitest (5.18.1)
|
|
122
123
|
nenv (0.3.0)
|
|
123
124
|
net-imap (0.3.6)
|
|
@@ -130,9 +131,8 @@ GEM
|
|
|
130
131
|
net-smtp (0.3.3)
|
|
131
132
|
net-protocol
|
|
132
133
|
nio4r (2.5.9)
|
|
133
|
-
nokogiri (1.15.3
|
|
134
|
-
|
|
135
|
-
nokogiri (1.15.3-x86_64-linux)
|
|
134
|
+
nokogiri (1.15.3)
|
|
135
|
+
mini_portile2 (~> 2.8.2)
|
|
136
136
|
racc (~> 1.4)
|
|
137
137
|
notiffany (0.1.3)
|
|
138
138
|
nenv (~> 0.1)
|
|
@@ -209,6 +209,7 @@ GEM
|
|
|
209
209
|
|
|
210
210
|
PLATFORMS
|
|
211
211
|
arm64-darwin-22
|
|
212
|
+
arm64-darwin-23
|
|
212
213
|
x86_64-linux
|
|
213
214
|
|
|
214
215
|
DEPENDENCIES
|
data/lib/superform/rails.rb
CHANGED
|
@@ -54,6 +54,10 @@ module Superform
|
|
|
54
54
|
Components::InputComponent.new(self, attributes: attributes)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
def checkbox(**attributes)
|
|
58
|
+
Components::CheckboxComponent.new(self, attributes: attributes)
|
|
59
|
+
end
|
|
60
|
+
|
|
57
61
|
def label(**attributes)
|
|
58
62
|
Components::LabelComponent.new(self, attributes: attributes)
|
|
59
63
|
end
|
|
@@ -245,6 +249,19 @@ module Superform
|
|
|
245
249
|
end
|
|
246
250
|
end
|
|
247
251
|
|
|
252
|
+
class CheckboxComponent < FieldComponent
|
|
253
|
+
def template(&)
|
|
254
|
+
# Rails has a hidden and checkbox input to deal with sending back a value
|
|
255
|
+
# to the server regardless of if the input is checked or not.
|
|
256
|
+
input(name: dom.name, type: :hidden, value: "0")
|
|
257
|
+
input(**attributes)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def field_attributes
|
|
261
|
+
{ id: dom.id, name: dom.name, value: "1", checked: field.value, type: :checkbox }
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
|
|
248
265
|
class InputComponent < FieldComponent
|
|
249
266
|
def template(&)
|
|
250
267
|
input(**attributes)
|
data/lib/superform/version.rb
CHANGED
data/lib/superform.rb
CHANGED
|
@@ -188,8 +188,8 @@ module Superform
|
|
|
188
188
|
|
|
189
189
|
# Checks if the child exists. If it does then it returns that. If it doesn't, it will
|
|
190
190
|
# build the child.
|
|
191
|
-
def create_child(key, child_class,
|
|
192
|
-
@children.fetch(key) { @children[key] = child_class.new(key, parent: self,
|
|
191
|
+
def create_child(key, child_class, **kwargs, &block)
|
|
192
|
+
@children.fetch(key) { @children[key] = child_class.new(key, parent: self, **kwargs, &block) }
|
|
193
193
|
end
|
|
194
194
|
end
|
|
195
195
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: superform
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brad Gessler
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-02-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: phlex-rails
|
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
85
|
version: '0'
|
|
86
86
|
requirements: []
|
|
87
|
-
rubygems_version: 3.
|
|
87
|
+
rubygems_version: 3.5.3
|
|
88
88
|
signing_key:
|
|
89
89
|
specification_version: 4
|
|
90
90
|
summary: Build forms in Rails
|