phlex-forms 0.2.0 → 0.2.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/lib/forms/fields_for_builder.rb +2 -0
- data/lib/forms/form.rb +7 -0
- data/lib/phlex_forms/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 07e978bd7062d93d342a6048d51a54559abecf20098ae39eda81c10497856578
|
|
4
|
+
data.tar.gz: 30c5714c27d7a892da6eb591a4c3e98cae860d0d971d47932e7eed2f127fe1da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ab143d433e88c413810036f0b53cc3f70c3eb74c75b0d5fb4f319b94c44ba9b62b003156274a95d67aa048623edeeafab45fc6e0bcc17875817c980f956126d
|
|
7
|
+
data.tar.gz: 502f58b8543f1b31ba0700a24da4588875945b38f54bf26ac411fa13b88c304f9d2250d822357e327a689ec58863b2d3651d16bb09ed20f7c486c24193259888
|
|
@@ -8,6 +8,7 @@ module Forms
|
|
|
8
8
|
include PhlexForms::Builder
|
|
9
9
|
|
|
10
10
|
attr_reader :model, :scope, :errors, :parent_form
|
|
11
|
+
alias object model # Rails form-builder compatibility (mirrors Forms::Form)
|
|
11
12
|
|
|
12
13
|
def initialize(model:, scope:, errors:, parent_form:)
|
|
13
14
|
@model = model
|
|
@@ -24,6 +25,7 @@ module Forms
|
|
|
24
25
|
def field_object(name, error_name: nil)
|
|
25
26
|
Forms::Field.new(name:, model: @model, scope: @scope, errors: @errors, form: @parent_form, error_name:)
|
|
26
27
|
end
|
|
28
|
+
alias [] field_object # `item_form[:id].hidden` — Rails form-builder-style access
|
|
27
29
|
|
|
28
30
|
def default_field_variants
|
|
29
31
|
@parent_form.default_field_variants
|
data/lib/forms/form.rb
CHANGED
|
@@ -19,6 +19,12 @@ module Forms
|
|
|
19
19
|
|
|
20
20
|
attr_reader :model, :scope, :url, :method, :errors, :validate, :theme
|
|
21
21
|
|
|
22
|
+
# Rails form-builder compatibility: `f.object` / `f.object_name` mirror the
|
|
23
|
+
# ActionView FormBuilder API so call sites that introspect the bound record
|
|
24
|
+
# (`f.object.class.reflect_on_association(...)`) keep working.
|
|
25
|
+
alias object model
|
|
26
|
+
alias object_name scope
|
|
27
|
+
|
|
22
28
|
def initialize(*modifiers, model: nil, scope: nil, url: nil, method: nil, validate: false,
|
|
23
29
|
field_variants: nil, theme: nil, live: nil, **options)
|
|
24
30
|
if live
|
|
@@ -66,6 +72,7 @@ module Forms
|
|
|
66
72
|
def field_object(name, error_name: nil)
|
|
67
73
|
Forms::Field.new(name:, model: @model, scope: @scope, errors: @errors, form: self, error_name:)
|
|
68
74
|
end
|
|
75
|
+
alias [] field_object # `f[:email].hidden` — Rails form-builder-style access
|
|
69
76
|
|
|
70
77
|
def submit(*, **, &)
|
|
71
78
|
render theme[:submit].new(*, model: @model, **, &)
|
data/lib/phlex_forms/version.rb
CHANGED