promethee 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: 2b518d1f83474f06c099c7714b4696d270cde07b
4
- data.tar.gz: 5401b785dce334c87e2c3de4d005b91ee2ec9bb0
3
+ metadata.gz: 0446ad6a008e7f126a6bd3e691f2d9fb1cdf1164
4
+ data.tar.gz: faffb9120096340ab927218699794449beeb1b08
5
5
  SHA512:
6
- metadata.gz: 117e2b926c3eca318925429f13c9013abf32d8f0345774747fbba7a7db084a3e2ef8f3d25b74a82839b9f3d61b85d43cbdceb48de7ebb0c35fa5a7dc8312d270
7
- data.tar.gz: 4047603f08cc82901a66db5bd2a13d1f20f9f583668f995e8695d7b8e79fbab65ec7a256828c1fc1d86b8fd168ef7ad2eb53bc91ea7dba4893c4011e50a56d30
6
+ metadata.gz: f428c8ae156ddb16051a183f7b4e5b721891baa1b2cf1501bb219954d4b6e2756e794a9d60bf2d45a666ace2ccbe43956f32e7b2dadfa823271c575a06eb13d7
7
+ data.tar.gz: fea5fa53d6f350df3666b5eb656ff0ffb75e5209227a663236a3038a4705a68968b6242463e9a410220466b68e3fa8c4f141e1b6ff7d1b4ac63bc9b9c1170793
@@ -1,4 +1,5 @@
1
1
  <%
2
+ master_data ||= {}
2
3
  promethee_data = Promethee::Data.new master_data
3
4
  %>
4
5
 
@@ -25,12 +26,12 @@ promethee_data = Promethee::Data.new master_data
25
26
  });
26
27
 
27
28
  promethee.controller('PrometheeController', ['data', '$scope', 'definitions', '$http', function(data, $scope, definitions, $http) {
28
-
29
+
29
30
  // Data (TODO use Adder and probably page definition to init)
30
31
  if (data === null || data === '') {
31
32
  data = {
32
33
  id: '',
33
- type: 'page',
34
+ type: 'page',
34
35
  version: 1,
35
36
  children: []
36
37
  };
@@ -73,19 +73,17 @@ module Promethee
73
73
  @master_data[:children]
74
74
  end
75
75
 
76
+ def flat_children
77
+ self.class.flatten_components @master_data_unlocalized[:children]
78
+ end
79
+
76
80
  def prepare_localization
77
81
  # TODO extract localizable components from master data, in the correct order, merged with existing ones
78
82
  # TODO update master_version
79
83
 
80
- # Flattens master data, and select only text components
81
- flat_master_data = self.class.flatten_components(@master_data_unlocalized[:children]).select do |component|
82
- component[:type].to_sym === :text
83
- end
84
-
85
- # We add master reference
86
- flat_master_data.each do |data|
87
- data[:master] = data.clone
88
- end
84
+ # Selects only text components within the children components flat array
85
+ # TODO think about a better way to handle localized attributes among all the components (not only text type)
86
+ flat_master_data = flat_children.select { |component| component[:type].to_sym === :text }
89
87
 
90
88
  if @localization_data
91
89
  # If localization_data has been provided, we merge flat_master_data components with its components
@@ -94,10 +92,9 @@ module Promethee
94
92
  localized_component[:id] == component[:id]
95
93
  end
96
94
 
97
- # Update master reference
98
- localized_component[:master] = component[:master] unless localized_component.nil?
99
-
100
- localized_component || component
95
+ # If the localized_component isn't found, we create it with the master (component)
96
+ # Eventually, we add a reference to the master in the localized component
97
+ (localized_component || component).merge master: component.deep_dup
101
98
  end
102
99
  else
103
100
  # In the other case, localization_data components are flat_master_data components
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Dargelos
@@ -345,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
345
  version: '0'
346
346
  requirements: []
347
347
  rubyforge_project:
348
- rubygems_version: 2.6.14
348
+ rubygems_version: 2.6.12
349
349
  signing_key:
350
350
  specification_version: 4
351
351
  summary: Bring fire to your page