superform 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e95163f7344e0731cc859cf60a4bc1486bede4fe3cc88c86a0bd98497ecdf369
4
- data.tar.gz: ebd8c4ea43a8958a4d6c70f4886aec84dd20a08a5b51563d18b2d65a4e2afff1
3
+ metadata.gz: 2db21420ecfac1a9133026933f8b05a9a7512bbc35c60ebf605abe88eda05d5b
4
+ data.tar.gz: 33761bcb89952fc6926f4ef798bb3c6665d2b4ce4528b7f451e58a103f9014bb
5
5
  SHA512:
6
- metadata.gz: 4d03e967c4e018cb6902ad360719b5c98c4f7ab698a3dd9b6b61d3f3e4fde98231242085657ad9da20258335b34e52c5df7087d9ff27b503fa3a37b69a0c9eab
7
- data.tar.gz: b859c82d78000486ab7b51070b22d4611f634513a5ba4f8f1f0c551e75ca3ced2549255858b1c56bc7fc48341ea35a84cc084c9be41af041840d45cb862fea6b
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.2)
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-arm64-darwin)
134
- racc (~> 1.4)
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
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superform
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.4"
5
5
  end
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.2
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: 2023-11-16 00:00:00.000000000 Z
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.4.6
87
+ rubygems_version: 3.5.3
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Build forms in Rails