egov_utils 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/egov_utils/people_controller.rb +3 -0
- data/app/helpers/egov_utils/grid_helper.rb +24 -1
- data/app/schemas/egov_utils/address_schema.rb +1 -1
- data/app/schemas/egov_utils/engine_schema.rb +13 -0
- data/app/schemas/egov_utils/user_schema.rb +1 -1
- data/lib/egov_utils/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eae0f0f3e3b9e24657d648a0ae710b0ea209b41385303a0dfe98996475f319b2
|
4
|
+
data.tar.gz: 5cf138da356f3ac4068f58a0e18d9fb7a1e51474fa7669c7c07a8e788c7a951b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f657dbbc3c0b06c7a832874d524aaf3bc9c42584c97d1d721c3fe229dd2ecf05a4d0f79ae9157dc35cf5c129d5358c79b9ccaea67d49405cfc6ded7c910deb5d
|
7
|
+
data.tar.gz: d7f627e6fa125e04d8520bb6a4fd21c76c1c35415f2756fa9b07a370dfa7fba6ea98ad92041e6f0bd43f64680d13d0d2dcc5be4b5674ea7023c6192d1a9cded0
|
@@ -27,11 +27,34 @@ module EgovUtils
|
|
27
27
|
s
|
28
28
|
end
|
29
29
|
|
30
|
+
def entity_template_path_for_schema(schema, id_template='{id}')
|
31
|
+
if schema.respond_to?('engine_name')
|
32
|
+
self.public_send(schema.engine_name).polymorphic_path(schema.model) + "/#{id_template}"
|
33
|
+
else
|
34
|
+
polymorphic_path(schema.model) + "/#{id_template}"
|
35
|
+
end
|
36
|
+
rescue NoMethodError => e
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
# TODO - what if the attribute is main for associated schema (legal_person-name for person schema)
|
41
|
+
def entity_template_path(schema, attribute)
|
42
|
+
if attribute.name == schema.main_attribute_name
|
43
|
+
entity_template_path_for_schema(schema)
|
44
|
+
elsif (base_schema = attribute.try(:base_schema)) && attribute.name =~ /#{base_schema.main_attribute_name}/
|
45
|
+
entity_template_path_for_schema(base_schema, "{#{attribute.primary_key_name}}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
30
49
|
def column_for_grid(grid, attribute)
|
31
50
|
s = "{"
|
32
51
|
s << "field: '#{attribute.name}'"
|
33
52
|
s << ", title: '#{attribute.attribute_name.human}'"
|
34
|
-
|
53
|
+
|
54
|
+
if (template_path = entity_template_path(grid.schema, attribute))
|
55
|
+
s << ", columnTemplate: '<a href=\"#{template_path}\">{#{attribute.name}}</div>'"
|
56
|
+
end
|
57
|
+
|
35
58
|
if attribute.type == 'list'
|
36
59
|
s << ", format: ( (value) -> I18n.t('#{attribute.attribute_name.i18n_scoped_list_prefix}'+'.'+value, {defaults: $.map( #{attribute.attribute_name.i18n_list_fallback_prefixes.to_json}, (pref, i)-> {scope: (pref + '.' + value)} )}) ) "
|
37
60
|
elsif attribute.type == 'date'
|
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.3.
|
4
|
+
version: 0.3.1
|
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: 2018-04-
|
11
|
+
date: 2018-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -426,6 +426,7 @@ files:
|
|
426
426
|
- app/resources/egov_utils/organization.rb
|
427
427
|
- app/schemas/egov_utils/abstract_person_schema.rb
|
428
428
|
- app/schemas/egov_utils/address_schema.rb
|
429
|
+
- app/schemas/egov_utils/engine_schema.rb
|
429
430
|
- app/schemas/egov_utils/legal_person_schema.rb
|
430
431
|
- app/schemas/egov_utils/natural_person_schema.rb
|
431
432
|
- app/schemas/egov_utils/person_schema.rb
|