egov_utils 0.1.8 → 0.1.9
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 +4 -4
- data/app/helpers/egov_utils/grid_helper.rb +8 -2
- data/config/locales/cs.yml +2 -0
- data/lib/egov_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0acb8a903d4ec6302d92915fff9a99e203ea7e76
|
4
|
+
data.tar.gz: 8320e02ca0f684d1542ee7d1ea9d0b08882782ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02b14675f1cb7215cca5143e3c813b853423e9906a374ff6580d0dea06a5f81f6f78ffa24ce3272fde4a1ef83c125a3d952d81bddacda461116c934989aa633
|
7
|
+
data.tar.gz: a8b9243c8928d3207325d55250ff1556c12ede9aa75e3160963d673728a2ea6bd91cfd9d1f6ed11a27d4472c42852739342fe9e85688f6c84074565c647e2424
|
@@ -1,8 +1,14 @@
|
|
1
1
|
module EgovUtils
|
2
2
|
module GridHelper
|
3
|
+
def grid_attributes_i18n_kyes(attribute)
|
4
|
+
keys = [ ('activerecord.attributes.'+attribute.model.model_name.i18n_key.to_s+'.'+attribute.name).to_sym ]
|
5
|
+
keys.concat( grid_attributes_i18n_kyes(attribute.attribute) ) if attribute.respond_to?(:attribute)
|
6
|
+
keys
|
7
|
+
end
|
8
|
+
|
3
9
|
def type_for_grid(type)
|
4
10
|
case type
|
5
|
-
when 'integer', 'float'
|
11
|
+
when 'integer', 'float', 'decimal'
|
6
12
|
'Number'
|
7
13
|
when 'string', 'list'
|
8
14
|
'String'
|
@@ -29,7 +35,7 @@ module EgovUtils
|
|
29
35
|
def column_for_grid(grid, attribute)
|
30
36
|
s = "{"
|
31
37
|
s << "field: '#{attribute.name}'"
|
32
|
-
s << ", title: '#{I18n.t('model_attributes.'+grid.model_i18n_key.to_s+'.'+attribute.name)}'"
|
38
|
+
s << ", title: '#{I18n.t('model_attributes.'+grid.model_i18n_key.to_s+'.'+attribute.name, default: grid_attributes_i18n_kyes(attribute))}'"
|
33
39
|
s << ", columnTemplate: '<a href=\"#{polymorphic_path(grid.schema.model)}/{id}\">{#{attribute.name}}</div>'" if attribute.name == grid.schema.main_attribute_name
|
34
40
|
if attribute.type == 'list'
|
35
41
|
s << ", format: ( (value) -> I18n.t(value, {scope: 'activerecord.attributes.#{attribute.model.model_name.i18n_key}.#{attribute.name.to_s.pluralize}'}) ) "
|
data/config/locales/cs.yml
CHANGED
data/lib/egov_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egov_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Ezr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|