shoelace-rails 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -2
- data/app/helpers/shoelace/form_helper.rb +4 -4
- data/lib/shoelace/rails/version.rb +1 -1
- data/test/helpers/translation_test.rb +10 -0
- 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: 9ead8cbfce57323de6e03b0b4dc638eac355b3a9e7495747a17aaf79682e81ed
|
4
|
+
data.tar.gz: 9c84316ec90e6a29fb270b3d0c56d9dbc93b947c51aab3fa3c07bac5620f4399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511f5b435164a36c9fe094ebdc905d05c3759cf469ec9559b9fd437171291b3b0b07361ecc674d120ed5b59b0683044582f1d5726c50f05df0e57ff972a185fc
|
7
|
+
data.tar.gz: 74f6c3f146f2aea79e9cce672c36840c4f416adf6ea14748dbfdf63ca0c92bbb1ad9041407df6ca91c93fd0334e6cb12e2e038fcb18d3eb13cdd970413459262
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
|
-
## v0.6.
|
1
|
+
## v0.6.2
|
2
2
|
|
3
3
|
#### 🐞Bug Fixes
|
4
4
|
|
5
|
-
- Fixes a bug where form builders fail to render
|
5
|
+
- Fixes a bug where form builders fail to render when it falls back to humanize the given method name
|
6
|
+
|
7
|
+
## [v0.6.1](https://github.com/yuki24/shoelace-rails/tree/v0.6.1)
|
8
|
+
|
9
|
+
_<sup>released at 2024-03-13 03:05:20 UTC</sup>_
|
10
|
+
|
11
|
+
#### 🐞Bug Fixes
|
12
|
+
|
13
|
+
- Fixes a bug where form builders fail to render with a string `:as` option
|
6
14
|
|
7
15
|
## [v0.6.0](https://github.com/yuki24/shoelace-rails/tree/v0.6.0)
|
8
16
|
|
@@ -57,7 +57,7 @@ module Shoelace
|
|
57
57
|
options = @options.stringify_keys
|
58
58
|
options["value"] = options.fetch("value") { value_before_type_cast }
|
59
59
|
add_default_name_and_id(options)
|
60
|
-
label = options.delete('label').presence || @method_name.humanize
|
60
|
+
label = options.delete('label').presence || @method_name.to_s.humanize
|
61
61
|
|
62
62
|
@template_object.content_tag('sl-switch', label, options, &block)
|
63
63
|
end
|
@@ -124,7 +124,7 @@ module Shoelace
|
|
124
124
|
options = @options.stringify_keys
|
125
125
|
options["value"] = @checked_value
|
126
126
|
options["checked"] = true if input_checked?(options)
|
127
|
-
label = options.delete("label") || @method_name.humanize
|
127
|
+
label = options.delete("label") || @method_name.to_s.humanize
|
128
128
|
|
129
129
|
if options["multiple"]
|
130
130
|
add_default_name_and_id_for_value(@checked_value, options)
|
@@ -183,7 +183,7 @@ module Shoelace
|
|
183
183
|
html_options = @html_options.stringify_keys
|
184
184
|
html_options["value"] = value
|
185
185
|
add_default_name_and_id(html_options)
|
186
|
-
html_options["label"] = @options[:label].presence || @method_name.humanize
|
186
|
+
html_options["label"] = @options[:label].presence || @method_name.to_s.humanize
|
187
187
|
|
188
188
|
@template_object.content_tag('sl-radio-group', html_options) { super(&block) }
|
189
189
|
end
|
@@ -270,7 +270,7 @@ module Shoelace
|
|
270
270
|
private
|
271
271
|
|
272
272
|
def label_text(method, tag_value = nil)
|
273
|
-
::ActionView::Helpers::Tags::Label::LabelBuilder.new(@template, object_name.to_s, method, object, tag_value).translation
|
273
|
+
::ActionView::Helpers::Tags::Label::LabelBuilder.new(@template, object_name.to_s, method.to_s, object, tag_value).translation
|
274
274
|
end
|
275
275
|
end
|
276
276
|
|
@@ -42,6 +42,16 @@ class TranslationTest < ActionView::TestCase
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
test "Form helpers should fall back to the humanize method when there is no matching translation" do
|
46
|
+
I18n.backend.reload!
|
47
|
+
|
48
|
+
sl_form_for(OpenStruct.new, as: :user, url: "/") do |form|
|
49
|
+
assert_dom_equal <<~HTML, form.text_field(:name_eq)
|
50
|
+
<sl-input label="Name eq" type="text" name="user[name_eq]" id="user_name_eq"></sl-input>
|
51
|
+
HTML
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
45
55
|
test "#color_field should respect label translations" do
|
46
56
|
sl_form_for(User.new, url: "/") do |form|
|
47
57
|
assert_dom_equal <<~HTML, form.color_field(:name)
|