superform 0.4.3 → 0.4.5
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/README.md +1 -1
- data/lib/superform/rails.rb +18 -0
- data/lib/superform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f08aba5c447c430ce4e06c86dacf7a6bc97cf95fd7ce379e913498fe3e809ab7
|
4
|
+
data.tar.gz: ce49b9e40f9f7ff9cc4bd2260918af3c16fa8689c3718281077170b9532613e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a392d567cba45cf0215131d00ef2557c4989cf020ded8d88f43c6d98c410ae743a629f322fab86addaa0980667a1af335a0effe318bd3d01adbeafcd1c543d5b
|
7
|
+
data.tar.gz: e7d2b01c137cefa7e0e6cefda057005af5f4e297e1e26b36be96f1c1276b0854ccd0352217d30efce471a7c08f1dda2ed5e024e9193321ebae922a9d32f04829
|
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.5)
|
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/README.md
CHANGED
@@ -157,7 +157,7 @@ class SignupForm < ApplicationForm
|
|
157
157
|
|
158
158
|
div do
|
159
159
|
render field(:agreement).label { "Check this box if you agree to give us your first born child" }
|
160
|
-
render field(:agreement).
|
160
|
+
render field(:agreement).checkbox(checked: true)
|
161
161
|
end
|
162
162
|
|
163
163
|
render button { "Submit" }
|
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,20 @@ 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
|
+
# The hard coded keys need to be in here so the user can't overrite them.
|
258
|
+
input(type: :checkbox, value: "1", **attributes)
|
259
|
+
end
|
260
|
+
|
261
|
+
def field_attributes
|
262
|
+
{ id: dom.id, name: dom.name, checked: field.value }
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
248
266
|
class InputComponent < FieldComponent
|
249
267
|
def template(&)
|
250
268
|
input(**attributes)
|
data/lib/superform/version.rb
CHANGED
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.5
|
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
|