dsfr-form_builder 0.0.6 → 0.0.8
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/dsfr-form_builder.rb +30 -6
- 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: 3a0c8e3318e640b14b7afd55c5537fe023032157365a84b21511711f838953f8
|
4
|
+
data.tar.gz: 0a4bb1ea72d2b0b10adcb0ceeeb3352f53e0085129be6ca9b92b2a5444cd6516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7c13e694c9ed5e71a2d337fcd144ceae3ab7be5a432a7bd6a23c1f5148edd9529c2000910dcbc597640a6b41b84a99663b176b9c3cc59cc98fde7c2ce903cff
|
7
|
+
data.tar.gz: '0428eb812019cb50208f820a582f8bdf37786f979cb660bd6b5952e905286142bbaefeffc9f84c61583180bd0c4c21eb3df17af110b06916f81894ba1eeefc04'
|
data/lib/dsfr-form_builder.rb
CHANGED
@@ -47,24 +47,38 @@ module Dsfr
|
|
47
47
|
@template.safe_join(
|
48
48
|
[
|
49
49
|
dsfr_label_with_hint(attribute, opts),
|
50
|
-
public_send(input_kind, attribute, class: "fr-input", **opts.except(:class, :hint)),
|
50
|
+
public_send(input_kind, attribute, class: "fr-input", **opts.except(:class, :hint, :label, :data)),
|
51
51
|
dsfr_error_message(attribute)
|
52
52
|
]
|
53
53
|
)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
58
|
-
@template.content_tag(:div, class:
|
57
|
+
def dsfr_file_field(attribute, opts = {})
|
58
|
+
@template.content_tag(:div, class: upload_group_classes(attribute, opts), data: opts[:data]) do
|
59
59
|
@template.safe_join(
|
60
60
|
[
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
dsfr_label_with_hint(attribute, opts.except(:class)),
|
62
|
+
file_field(attribute, class: "fr-upload", **opts.except(:class, :hint, :label, :data)),
|
63
|
+
dsfr_error_message(attribute)
|
64
|
+
].compact
|
64
65
|
)
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
69
|
+
def dsfr_check_box(attribute, opts = {}, checked_value = "1", unchecked_value = "0")
|
70
|
+
@template.content_tag(:div, class: "fr-fieldset__element") do
|
71
|
+
@template.content_tag(:div, class: "fr-checkbox-group") do
|
72
|
+
@template.safe_join(
|
73
|
+
[
|
74
|
+
check_box(attribute, opts, checked_value, unchecked_value),
|
75
|
+
dsfr_label_with_hint(attribute, opts)
|
76
|
+
]
|
77
|
+
)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
68
82
|
def dsfr_select(attribute, choices, input_options: {}, **opts)
|
69
83
|
@template.content_tag(:div, class: "fr-select-group") do
|
70
84
|
@template.safe_join(
|
@@ -166,6 +180,16 @@ module Dsfr
|
|
166
180
|
)
|
167
181
|
end
|
168
182
|
|
183
|
+
def upload_group_classes(attribute, opts)
|
184
|
+
join_classes(
|
185
|
+
[
|
186
|
+
"fr-upload-group",
|
187
|
+
@object.errors[attribute].any? ? "fr-upload-group--error" : nil,
|
188
|
+
opts[:class]
|
189
|
+
]
|
190
|
+
)
|
191
|
+
end
|
192
|
+
|
169
193
|
def label_value(attribute, opts)
|
170
194
|
return opts[:label] if opts[:label]
|
171
195
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dsfr-form_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BetaGouv developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|