promethee 4.0.3 → 4.0.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76e663e139d3bd43329b381a2e2c384ebf937dd2624262b13a4809f1ebcc04d4
|
4
|
+
data.tar.gz: adff91940f67347c2aa416294622fac027cccd7060faa6a7d604e4f50909f0ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c51fb79481fdcdf3ef1995e31974e2fdf531e1a2e6b71f87d21c810afd6a76182a9594d8d05641256fbdfaabdd230e0be5943c5bd8ffe3f278ada386c9841bb
|
7
|
+
data.tar.gz: d4f0b1d78c0ddbca24a2aec07481af7b9cdb0e4add0f0eca57bcfbb6dbc2b5f38df876f05d32b47daab490937e1e1a337c01798aa4bda60d4affebc802b9128b
|
@@ -13,6 +13,7 @@ module Promethee::StructureUpgrader::Components
|
|
13
13
|
|
14
14
|
def upgrade
|
15
15
|
@upgraded_data = @data.deep_dup
|
16
|
+
@upgraded_data['attributes'] ||= {}
|
16
17
|
return if @upgraded_data['attributes'].empty?
|
17
18
|
|
18
19
|
@upgraded_data['attributes'] = upgraded_attributes.deep_stringify_keys
|
@@ -32,10 +32,12 @@ module Promethee::StructureUpgrader::Components
|
|
32
32
|
private
|
33
33
|
|
34
34
|
def upgraded_backgrounds(backgrounds)
|
35
|
+
backgrounds ||= []
|
35
36
|
backgrounds.map { |background|
|
36
37
|
{
|
37
38
|
'image' => {
|
38
39
|
'searchable' => false,
|
40
|
+
'translatable' => false,
|
39
41
|
'type' => 'blob',
|
40
42
|
'value' => background['image']
|
41
43
|
},
|
@@ -46,6 +48,7 @@ module Promethee::StructureUpgrader::Components
|
|
46
48
|
{ 'label' => 'Right', 'value' => 'right' }
|
47
49
|
],
|
48
50
|
'searchable' => false,
|
51
|
+
'translatable' => false,
|
49
52
|
'type' => 'enum',
|
50
53
|
'value' => background['posh']
|
51
54
|
},
|
@@ -56,6 +59,7 @@ module Promethee::StructureUpgrader::Components
|
|
56
59
|
{ 'label' => 'Bottom', 'value' => 'bottom' }
|
57
60
|
],
|
58
61
|
'searchable' => false,
|
62
|
+
'translatable' => false,
|
59
63
|
'type' => 'enum',
|
60
64
|
'value' => background['posv']
|
61
65
|
},
|
@@ -66,6 +70,7 @@ module Promethee::StructureUpgrader::Components
|
|
66
70
|
{ 'label' => 'Contain', 'value' => 'contain' }
|
67
71
|
],
|
68
72
|
'searchable' => false,
|
73
|
+
'translatable' => false,
|
69
74
|
'type' => 'enum',
|
70
75
|
'value' => background['size']
|
71
76
|
}
|
@@ -57,31 +57,34 @@ class Promethee::StructureUpgraderService
|
|
57
57
|
def process_localization(data)
|
58
58
|
data['components'].map! { |component|
|
59
59
|
process_localization_component(component)
|
60
|
-
}
|
60
|
+
}.compact!
|
61
61
|
|
62
62
|
# We remove the possible children to concatenate them to the list
|
63
63
|
children = []
|
64
64
|
data['components'].each { |component|
|
65
65
|
children.concat component.delete('children').to_a
|
66
66
|
}
|
67
|
-
data['components'].concat
|
67
|
+
data['components'].concat(children).compact!
|
68
68
|
|
69
69
|
data
|
70
70
|
end
|
71
71
|
|
72
72
|
def process_localization_component(component)
|
73
73
|
upgraded_component = process_component(component)
|
74
|
+
return nil if upgraded_component.nil?
|
74
75
|
# We only keep the translatable attributes
|
75
76
|
upgraded_component['attributes'].keep_if { |key, object_value| object_value['translatable'] }
|
76
77
|
upgraded_component
|
77
78
|
end
|
78
79
|
|
79
80
|
def process_component(data)
|
81
|
+
return nil unless data.has_key? 'type'
|
82
|
+
|
80
83
|
component_type = data['type']
|
81
84
|
component_upgrader = search_component(component_type).new(data)
|
82
85
|
|
83
86
|
data = component_upgrader.upgraded_data
|
84
|
-
data['children'].map! { |child| process_component(child) } if data.has_key? 'children'
|
87
|
+
data['children'].map! { |child| process_component(child) }.compact! if data.has_key? 'children'
|
85
88
|
|
86
89
|
data
|
87
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promethee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sébastien Gaya
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2019-
|
17
|
+
date: 2019-12-03 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rails
|