view_component-form 0.2.11 → 0.3.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 +19 -2
- data/README.md +2 -2
- data/app/components/view_component/form/collection_check_boxes_component.rb +0 -10
- data/app/components/view_component/form/field_component.rb +2 -2
- data/app/components/view_component/form/label_component.rb +1 -1
- data/lib/view_component/form/builder.rb +1 -0
- data/lib/view_component/form/helpers/custom.rb +2 -2
- data/lib/view_component/form/helpers/rails.rb +10 -10
- data/lib/view_component/form/helpers/rails8.rb +2 -2
- data/lib/view_component/form/renderer.rb +3 -3
- data/lib/view_component/form/test_helpers.rb +1 -1
- data/lib/view_component/form/version.rb +1 -1
- metadata +10 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb7de8796f3d1d1c9b97fc0a44be13dcd52c2bbb7a110e3fae30b304de6878a4
|
|
4
|
+
data.tar.gz: e4433d65cddff7b870dc6f27d6c160cbc7ead213c36f328508001c849824786a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a761bdd5ca27a3eec09758e4208b18a6e4e268479e04c7a6fb64cae9552405430743e20592aed3c31837e22c63b3c989e269231a62a3cfe09ad9d6d5a8e6035f
|
|
7
|
+
data.tar.gz: e3180c117bbdf67b537cbb1f8ebdeca0aa829248d9bed006878301908b267f27c35fff6527aa85385e2b034052506240b06cd35e95464fa9e995df7c933f3b4e
|
data/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
|
-
Nothing yet
|
|
8
|
+
Nothing yet.
|
|
9
|
+
|
|
10
|
+
## [0.3.1] - 2026-08-07
|
|
11
|
+
### Fixed
|
|
12
|
+
- Detect required association validators for `_id` and `_ids` fields (#229)
|
|
13
|
+
### Changed
|
|
14
|
+
- Remove upper bound for Rails dependencies (#206)
|
|
15
|
+
|
|
16
|
+
## [0.3.0] - 2025-10-24
|
|
17
|
+
### Added
|
|
18
|
+
- Support for Rails 8.1
|
|
19
|
+
- Support for view_component 4.x
|
|
20
|
+
### Removed
|
|
21
|
+
- Drop Ruby 3.1 support (EOL March 31, 2025)
|
|
22
|
+
- Drop Rails 7.0 support (EOL)
|
|
23
|
+
- Drop Rails 7.1 support (EOL)
|
|
9
24
|
|
|
10
25
|
## [0.2.11] - 2025-04-05
|
|
11
26
|
### Fixed
|
|
@@ -137,7 +152,9 @@ Nothing yet
|
|
|
137
152
|
- Add CHANGELOG (#50)
|
|
138
153
|
- Add CI (#2)
|
|
139
154
|
|
|
140
|
-
[Unreleased]: https://github.com/pantographe/view_component-form/compare/v0.
|
|
155
|
+
[Unreleased]: https://github.com/pantographe/view_component-form/compare/v0.3.1...HEAD
|
|
156
|
+
[0.3.1]: https://github.com/pantographe/view_component-form/compare/v0.3.0...v0.3.1
|
|
157
|
+
[0.3.0]: https://github.com/pantographe/view_component-form/compare/v0.2.11...v0.3.0
|
|
141
158
|
[0.2.11]: https://github.com/pantographe/view_component-form/compare/v0.2.10...v0.2.11
|
|
142
159
|
[0.2.10]: https://github.com/pantographe/view_component-form/compare/v0.2.9...v0.2.10
|
|
143
160
|
[0.2.9]: https://github.com/pantographe/view_component-form/compare/v0.2.8...v0.2.9
|
data/README.md
CHANGED
|
@@ -41,16 +41,6 @@ module ViewComponent
|
|
|
41
41
|
).render(&element_proc)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
# See: https://github.com/rails/rails/blob/83217025a171593547d1268651b446d3533e2019/actionview/lib/action_view/helpers/tags/label.rb#L64
|
|
45
|
-
def builder
|
|
46
|
-
@builder ||= begin
|
|
47
|
-
tag_value = options.delete("value")
|
|
48
|
-
|
|
49
|
-
ActionView::Helpers::Tags::Label::LabelBuilder.new(@view_context, object_name, method_name, object, tag_value)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
delegate :translation, to: :builder
|
|
53
|
-
|
|
54
44
|
protected
|
|
55
45
|
|
|
56
46
|
def set_html_options!
|
|
@@ -35,7 +35,7 @@ module ViewComponent
|
|
|
35
35
|
def method_errors?
|
|
36
36
|
return false unless object_errors
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
object_errors.attribute_names.intersect?(object_method_names)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def value
|
|
@@ -98,7 +98,7 @@ module ViewComponent
|
|
|
98
98
|
@method_validators ||= if object.nil?
|
|
99
99
|
[]
|
|
100
100
|
else
|
|
101
|
-
object.class.validators_on(
|
|
101
|
+
object.class.validators_on(*object_method_names)
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
end
|
|
@@ -28,7 +28,7 @@ module ViewComponent
|
|
|
28
28
|
options).render
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# See: https://github.com/rails/rails/blob/83217025a171593547d1268651b446d3533e2019/actionview/lib/action_view/helpers/tags/label.rb#
|
|
31
|
+
# See: https://github.com/rails/rails/blob/83217025a171593547d1268651b446d3533e2019/actionview/lib/action_view/helpers/tags/label.rb#L48
|
|
32
32
|
def builder
|
|
33
33
|
@builder ||= begin
|
|
34
34
|
tag_value = options.delete("value")
|
|
@@ -6,6 +6,7 @@ module ViewComponent
|
|
|
6
6
|
include ViewComponent::Form::Renderer
|
|
7
7
|
include ViewComponent::Form::ValidationContext
|
|
8
8
|
include ViewComponent::Form::Helpers::Rails
|
|
9
|
+
|
|
9
10
|
if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new("8.0")
|
|
10
11
|
include ViewComponent::Form::Helpers::Rails8
|
|
11
12
|
end
|
|
@@ -8,8 +8,8 @@ module ViewComponent
|
|
|
8
8
|
render_component(:error_message, @object_name, method, objectify_options(options))
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
def hint(method, text = nil, options = {}, &
|
|
12
|
-
render_component(:hint, @object_name, method, text, objectify_options(options), &
|
|
11
|
+
def hint(method, text = nil, options = {}, &)
|
|
12
|
+
render_component(:hint, @object_name, method, text, objectify_options(options), &)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -45,8 +45,8 @@ module ViewComponent
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# See: https://github.com/rails/rails/blob/33d60cb02dcac26d037332410eabaeeb0bdc384c/actionview/lib/action_view/helpers/form_helper.rb#L2280
|
|
48
|
-
def label(method, text = nil, options = {}, &
|
|
49
|
-
render_component(:label, @object_name, method, text, objectify_options(options), &
|
|
48
|
+
def label(method, text = nil, options = {}, &)
|
|
49
|
+
render_component(:label, @object_name, method, text, objectify_options(options), &)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def datetime_field(method, options = {})
|
|
@@ -80,20 +80,20 @@ module ViewComponent
|
|
|
80
80
|
render_component(:submit, value, options)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
def button(value = nil, options = {}, &
|
|
83
|
+
def button(value = nil, options = {}, &)
|
|
84
84
|
if value.is_a?(Hash)
|
|
85
85
|
options = value
|
|
86
86
|
value = nil
|
|
87
87
|
end
|
|
88
88
|
value ||= submit_default_value
|
|
89
|
-
render_component(:button, value, options, &
|
|
89
|
+
render_component(:button, value, options, &)
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
# See: https://github.com/rails/rails/blob/fe76a95b0d252a2d7c25e69498b720c96b243ea2/actionview/lib/action_view/helpers/form_options_helper.rb
|
|
93
|
-
def select(method, choices = nil, options = {}, html_options = {}, &
|
|
93
|
+
def select(method, choices = nil, options = {}, html_options = {}, &)
|
|
94
94
|
render_component(
|
|
95
95
|
:select, @object_name, method, choices, objectify_options(options),
|
|
96
|
-
@default_html_options.merge(html_options), &
|
|
96
|
+
@default_html_options.merge(html_options), &
|
|
97
97
|
)
|
|
98
98
|
end
|
|
99
99
|
|
|
@@ -118,10 +118,10 @@ module ViewComponent
|
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {},
|
|
121
|
-
&
|
|
121
|
+
&)
|
|
122
122
|
render_component(
|
|
123
123
|
:collection_check_boxes, @object_name, method, collection, value_method, text_method,
|
|
124
|
-
objectify_options(options), @default_html_options.merge(html_options), &
|
|
124
|
+
objectify_options(options), @default_html_options.merge(html_options), &
|
|
125
125
|
)
|
|
126
126
|
end
|
|
127
127
|
|
|
@@ -129,11 +129,11 @@ module ViewComponent
|
|
|
129
129
|
method, collection,
|
|
130
130
|
value_method, text_method,
|
|
131
131
|
options = {}, html_options = {},
|
|
132
|
-
&
|
|
132
|
+
&
|
|
133
133
|
)
|
|
134
134
|
render_component(
|
|
135
135
|
:collection_radio_buttons, @object_name, method, collection, value_method, text_method,
|
|
136
|
-
objectify_options(options), @default_html_options.merge(html_options), &
|
|
136
|
+
objectify_options(options), @default_html_options.merge(html_options), &
|
|
137
137
|
)
|
|
138
138
|
end
|
|
139
139
|
# rubocop:enable Metrics/ParameterLists
|
|
@@ -17,10 +17,10 @@ module ViewComponent
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def collection_checkboxes(method, collection, value_method, text_method, options = {}, html_options = {}, # rubocop:disable Metrics/ParameterLists
|
|
20
|
-
&
|
|
20
|
+
&)
|
|
21
21
|
render_component(
|
|
22
22
|
:collection_check_boxes, @object_name, method, collection, value_method, text_method,
|
|
23
|
-
objectify_options(options), @default_html_options.merge(html_options), &
|
|
23
|
+
objectify_options(options), @default_html_options.merge(html_options), &
|
|
24
24
|
)
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -41,9 +41,9 @@ module ViewComponent
|
|
|
41
41
|
|
|
42
42
|
private
|
|
43
43
|
|
|
44
|
-
def render_component(component_name,
|
|
45
|
-
component = component_klass(component_name).new(self, *
|
|
46
|
-
component.render_in(@template, &
|
|
44
|
+
def render_component(component_name, *, &)
|
|
45
|
+
component = component_klass(component_name).new(self, *)
|
|
46
|
+
component.render_in(@template, &)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def objectify_options(options)
|
|
@@ -8,7 +8,7 @@ class TestView < ActionView::Base
|
|
|
8
8
|
include ActionText::TagHelper if defined?(ActionText)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
module ViewComponent
|
|
11
|
+
module ViewComponent # rubocop:disable Style/OneClassPerFile
|
|
12
12
|
module Form
|
|
13
13
|
module TestHelpers
|
|
14
14
|
def form_with(object, builder: ViewComponent::Form::Builder, **options)
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: view_component-form
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pantographe
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
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: actionview
|
|
@@ -16,40 +15,28 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 7.
|
|
20
|
-
- - "<"
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: '8.1'
|
|
18
|
+
version: 7.2.0
|
|
23
19
|
type: :runtime
|
|
24
20
|
prerelease: false
|
|
25
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
22
|
requirements:
|
|
27
23
|
- - ">="
|
|
28
24
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 7.
|
|
30
|
-
- - "<"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '8.1'
|
|
25
|
+
version: 7.2.0
|
|
33
26
|
- !ruby/object:Gem::Dependency
|
|
34
27
|
name: activesupport
|
|
35
28
|
requirement: !ruby/object:Gem::Requirement
|
|
36
29
|
requirements:
|
|
37
30
|
- - ">="
|
|
38
31
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 7.
|
|
40
|
-
- - "<"
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
version: '8.1'
|
|
32
|
+
version: 7.2.0
|
|
43
33
|
type: :runtime
|
|
44
34
|
prerelease: false
|
|
45
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
46
36
|
requirements:
|
|
47
37
|
- - ">="
|
|
48
38
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: 7.
|
|
50
|
-
- - "<"
|
|
51
|
-
- !ruby/object:Gem::Version
|
|
52
|
-
version: '8.1'
|
|
39
|
+
version: 7.2.0
|
|
53
40
|
- !ruby/object:Gem::Dependency
|
|
54
41
|
name: view_component
|
|
55
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -59,7 +46,7 @@ dependencies:
|
|
|
59
46
|
version: 2.34.0
|
|
60
47
|
- - "<"
|
|
61
48
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '
|
|
49
|
+
version: '5.0'
|
|
63
50
|
type: :runtime
|
|
64
51
|
prerelease: false
|
|
65
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -69,7 +56,7 @@ dependencies:
|
|
|
69
56
|
version: 2.34.0
|
|
70
57
|
- - "<"
|
|
71
58
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '
|
|
59
|
+
version: '5.0'
|
|
73
60
|
- !ruby/object:Gem::Dependency
|
|
74
61
|
name: zeitwerk
|
|
75
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -153,7 +140,6 @@ metadata:
|
|
|
153
140
|
source_code_uri: https://github.com/pantographe/view_component-form
|
|
154
141
|
bug_tracker_uri: https://github.com/pantographe/view_component-form/issues
|
|
155
142
|
rubygems_mfa_required: 'true'
|
|
156
|
-
post_install_message:
|
|
157
143
|
rdoc_options: []
|
|
158
144
|
require_paths:
|
|
159
145
|
- lib
|
|
@@ -161,15 +147,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
161
147
|
requirements:
|
|
162
148
|
- - ">="
|
|
163
149
|
- !ruby/object:Gem::Version
|
|
164
|
-
version: 3.
|
|
150
|
+
version: 3.2.0
|
|
165
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
152
|
requirements:
|
|
167
153
|
- - ">="
|
|
168
154
|
- !ruby/object:Gem::Version
|
|
169
155
|
version: '0'
|
|
170
156
|
requirements: []
|
|
171
|
-
rubygems_version:
|
|
172
|
-
signing_key:
|
|
157
|
+
rubygems_version: 4.0.16
|
|
173
158
|
specification_version: 4
|
|
174
159
|
summary: Rails FormBuilder for ViewComponent
|
|
175
160
|
test_files: []
|