simple_form_localized_input 1.0.7 → 1.0.9

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: e4f06f9b3bc8a0486acb4b858349de9b5793479ae62d86acf9116ecc87c09f2f
4
- data.tar.gz: 844d7474f3e2ca281118e89c7592596d99346af7fa3feeb48d9376bea5ceac61
3
+ metadata.gz: e7be0dfaf900460ac0a46a46d86c4df2320dacacf0c704dee137df7d920fa93b
4
+ data.tar.gz: 5d5b90b94f8e1b03ac851224439fc1b15e1cf8bb6611e857a5c114dbd040c9aa
5
5
  SHA512:
6
- metadata.gz: a5f3eb296d531f7671581505fdf68933c9fd133e8043848e5a70d0e46f9f74de96e9bfea26177b22c78fe0458abd62dc30ddc2a5c019d624b7a114bf522db9a8
7
- data.tar.gz: 8e1b602ea9adb65622de02008fc96587f5509d0a4bc14225dbdb8773d779ddf3a31a9c1e3fba2ca4541bb85e07fd8f9f8660ed72e4716486d44b4a63590d32a3
6
+ metadata.gz: '07995481c4e5854f18062756ccbad4d34289d66b1437e4ed817ef0d54f2f87f147837657eea29684d927af6d53c8d6d3f92dca04fc8e3a287ddc311cf52de15b'
7
+ data.tar.gz: 4ba03cbc46fdd341b1e009d2b66b4fb5759c027a7234cd3aa58b2e1cccb2dab4d78f75ace45af3f1e23d6ce755ea9fe19fa08acca467ae7f7c3a2ce15af5e89c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.9
4
+
5
+ * hook into `SimpleForm` `#label_text` method for full `I18n` support
6
+
3
7
  ## 1.0.7
4
8
 
5
9
  * add support for `LocalizedPresenceValidator`
@@ -13,14 +13,28 @@ module SimpleFormLocalizedInput
13
13
  simple_fields_for(field_name, field_value) do |fields|
14
14
  ::I18n.available_locales.collect do |loc|
15
15
  collection = options[:collection_translations] ? options[:collection_translations][loc.to_s] : options[:collection]
16
- label = [object.class.human_attribute_name(attribute_name), "(#{loc})"].reject(&:blank?).join(' ')
16
+
17
+ column = find_attribute_column(attribute_name)
18
+ input_type = default_input_type(attribute_name, column, options)
19
+
20
+ localized_label = SimpleForm::Inputs::Base.new(
21
+ self,
22
+ attribute_name,
23
+ column,
24
+ input_type,
25
+ options
26
+ ).send(:raw_label_text)
27
+
17
28
  required = object.class.validators_on(attribute_name).any? do |v|
18
29
  v.kind == :presence &&
19
30
  valid_validator?(v) &&
20
31
  valid_localized_presence_validator?(v, loc)
21
32
  end
22
33
 
23
- fields.input(loc.to_sym, options.merge(collection: collection, label: label, required: required))
34
+ fields.input(
35
+ loc.to_sym,
36
+ options.merge(collection: collection, label: "#{localized_label} (#{loc})".html_safe, required: required)
37
+ )
24
38
  end.join.html_safe
25
39
  end + error(attribute_name)
26
40
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormLocalizedInput
2
- VERSION = '1.0.7'.freeze
2
+ VERSION = '1.0.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_localized_input
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-11 00:00:00.000000000 Z
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_form