formatic 0.6.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d41f61aacdbc9679d1e63ff82441ac6008ae35f53a8b5425986e3bac53baeb0d
4
- data.tar.gz: 2974cac3f7d742dc001b45a2c5cdfe81f71e4e2cfd24d6052b4d563a790423c7
3
+ metadata.gz: c770f8b2518ead02b5d2a7797068c3192ed9d264e22d59af830569eb07a6c0ef
4
+ data.tar.gz: ffc6912dea00ef5faf99fa815d7d3173d446fb07f312c160a80e6d29f9ec175c
5
5
  SHA512:
6
- metadata.gz: 4da00730403d13520acf91dd762fe73e9a007ba6ba4146aa96cfb40d9e18ee71e4d45eb54569fab08a87df55838ee6c6302b1881c6b4a8eaa3376b10cf91462f
7
- data.tar.gz: 7d37f9de2bb33f902fb85390aa8bcdc0f1500131196cf55107eeaaa5df94cd78e22bb34bc88cadaae41ac20457eb3d74d34053989da08d457d7e2a04f99cfd51
6
+ metadata.gz: eaf5adeb08637ff84743f4a0c26c694533af908ee64d716340f96478fed4cc2a93004bf73a5bb3c50d8be4b647e703ab7f5d9bafb93cad4e483473c60501760c
7
+ data.tar.gz: af465ca562212a64012756431fd96340d2e44c5d68a11ee4ede6a912f2e8d5627b853140b0f759d57d84f90f1d6722aab752496e47a386bd5c56132f7d5d9e0f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.6.1] 2026-10-26
2
+
3
+ - Proper i18n for Formatic::Search placeholders
4
+
1
5
  ## [0.6.0] 2026-10-26
2
6
 
3
7
  - Include `Formatic::Testing::Capybara::Search` in a Capybara RackTest class to call `search 'Acme Corp', from: 'Customer'`
data/README.md CHANGED
@@ -22,6 +22,11 @@ when its query still matches the input. An optional `with_clear` slot clears
22
22
  the current selection.
23
23
  An optional `with_add_record` slot stays hidden while searching and appears
24
24
  after a successful response, even when there are no matches.
25
+ The query input uses a field-specific `placeholder:` or `helpers.placeholder`
26
+ translation when present. Otherwise it combines the translated label with the
27
+ localized search prompt. English and German prompts are included; other locales
28
+ fall back to the label. Search fields prevent implicit form submission on Enter
29
+ by default; pass `prevent_submit_on_enter: false` to disable that behavior.
25
30
 
26
31
  ```ruby
27
32
  = render Formatic::Search.new(f:, attribute_name: :commander_id,
@@ -9,6 +9,7 @@ module Formatic
9
9
  option :record_name, as: :manual_record_name, optional: true
10
10
  option :exclude_ids, default: -> { [] }
11
11
  option :placeholder, as: :manual_placeholder, optional: true
12
+ option :prevent_submit_on_enter, default: -> { true }
12
13
 
13
14
  renders_one :selected_record
14
15
  renders_one :add_record
@@ -24,7 +25,11 @@ module Formatic
24
25
  end
25
26
 
26
27
  def search_placeholder
27
- manual_placeholder.presence || wrapper.placeholder
28
+ return manual_placeholder if manual_placeholder.present?
29
+ return wrapper.placeholder if wrapper.placeholder.present?
30
+
31
+ translated_label = helpers.strip_tags(f.label(attribute_name))
32
+ ::I18n.t('formatic.search.placeholder', label: translated_label, default: translated_label)
28
33
  end
29
34
  end
30
35
  end
@@ -3,3 +3,6 @@ de:
3
3
 
4
4
  date:
5
5
  blank: Leer
6
+
7
+ search:
8
+ placeholder: '%{label} suchen...'
@@ -3,3 +3,6 @@ en:
3
3
 
4
4
  date:
5
5
  blank: Blank
6
+
7
+ search:
8
+ placeholder: Search %{label}...
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Formatic
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - halo
@@ -249,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
251
  requirements: []
252
- rubygems_version: 4.0.6
252
+ rubygems_version: 4.0.20
253
253
  specification_version: 4
254
254
  summary: A set of ViewComponents for form elements
255
255
  test_files: []