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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/simple_form_localized_input/form_builder.rb +16 -2
- data/lib/simple_form_localized_input/version.rb +1 -1
- 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: e7be0dfaf900460ac0a46a46d86c4df2320dacacf0c704dee137df7d920fa93b
|
4
|
+
data.tar.gz: 5d5b90b94f8e1b03ac851224439fc1b15e1cf8bb6611e857a5c114dbd040c9aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '07995481c4e5854f18062756ccbad4d34289d66b1437e4ed817ef0d54f2f87f147837657eea29684d927af6d53c8d6d3f92dca04fc8e3a287ddc311cf52de15b'
|
7
|
+
data.tar.gz: 4ba03cbc46fdd341b1e009d2b66b4fb5759c027a7234cd3aa58b2e1cccb2dab4d78f75ace45af3f1e23d6ce755ea9fe19fa08acca467ae7f7c3a2ce15af5e89c
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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(
|
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
|
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.
|
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
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_form
|