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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 220b7683429f052cb711bac68076e05f812a19c7857864e66bc3863ca5740b78
4
- data.tar.gz: 3947f8255bdb9a41d7faee272b77e356a78a233719b8e2b1d15e4bc814668fe1
3
+ metadata.gz: 9ead8cbfce57323de6e03b0b4dc638eac355b3a9e7495747a17aaf79682e81ed
4
+ data.tar.gz: 9c84316ec90e6a29fb270b3d0c56d9dbc93b947c51aab3fa3c07bac5620f4399
5
5
  SHA512:
6
- metadata.gz: '039b7be7a76bd89494cc7a95fab19d702c2ec87fc49f35dd6d19a88c7cc2ef0ebc1867d499a0e71b59044421d0199efed9b42417b1d8f38d3513157d5eebaf94'
7
- data.tar.gz: fc32460b9adadafdf3bc35be7bf8c360a2e9dd5d2645edad50f9f7efeb420275ce2be57df4f3653b88efaf3254686a158b06b512d2201079cae661fade8c0419
6
+ metadata.gz: 511f5b435164a36c9fe094ebdc905d05c3759cf469ec9559b9fd437171291b3b0b07361ecc674d120ed5b59b0683044582f1d5726c50f05df0e57ff972a185fc
7
+ data.tar.gz: 74f6c3f146f2aea79e9cce672c36840c4f416adf6ea14748dbfdf63ca0c92bbb1ad9041407df6ca91c93fd0334e6cb12e2e038fcb18d3eb13cdd970413459262
data/CHANGELOG.md CHANGED
@@ -1,8 +1,16 @@
1
- ## v0.6.1
1
+ ## v0.6.2
2
2
 
3
3
  #### 🐞Bug Fixes
4
4
 
5
- - Fixes a bug where form builders fail to render wtih a string `:as` option
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Shoelace
4
4
  module Rails
5
- VERSION = "0.6.1"
5
+ VERSION = "0.6.2"
6
6
  end
7
7
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoelace-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Nishijima