promethee 1.7.1 → 1.7.2

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: 5e202e7ffd817f5a07854497c59ade42067f7e3ad1a44fb3d55e7a8f5b89f221
4
- data.tar.gz: 84f0d2f18ab92b60a294131826607817bfba7175e445dd17517cf2102db6914a
3
+ metadata.gz: 830a5df82ba3d7061fbb76916d8ebf5775c0d930c42ab1fb9b7a767276709e32
4
+ data.tar.gz: 73587510af2189dd522402903a7e6168fdd8c79c165e0ddb04cf1419cb725483
5
5
  SHA512:
6
- metadata.gz: 71138249e1f16f4d9bafc0b097db1349e6dc3d193f42001775afb2c6beccd87a19b0862f3b4e453189a1066f13b8c3783e603220b9c1a48de990cd15b38fdc66
7
- data.tar.gz: 0c1019c2ca28bae6f8f667d740fc372e76f6f0c9da8c74cb0af89b3fced4c3bed39dbab8fe73ec604c4f2be60cd26739c47cbda393c6a71e600e83ad5ac1a032
6
+ metadata.gz: 3f20fce51ba8489ce01f449c04381566df8a82d724192acf061d2fb43c66fd0b10fc3cd1da69545babdca27ec4df5b164295f7fb371d6237975f11433e9b2512
7
+ data.tar.gz: a40324a77abf49e3a66ec40f63d375ace44b002ca1ce1819f945a1445bb829b6f891a40d4cd21d502a8f16e2414f5a45f39b7dceba1e2cf9dfa8f043dba891c3
@@ -11,7 +11,7 @@ module PrometheeData
11
11
  def promethee_data_page_title
12
12
  data['attributes']['searchable_title']
13
13
  rescue
14
- ""
14
+ ''
15
15
  end
16
16
 
17
17
  def promethee_data_page_title=(value)
@@ -21,7 +21,7 @@ module PrometheeData
21
21
  def promethee_data_page_description
22
22
  data['attributes']['searchable_description']
23
23
  rescue
24
- ""
24
+ ''
25
25
  end
26
26
 
27
27
  def promethee_data_page_description=(value)
@@ -32,13 +32,13 @@ module PrometheeData
32
32
  def promethee_data_translation_title
33
33
  data['components'].first['attributes']['searchable_title']
34
34
  rescue
35
- ""
35
+ ''
36
36
  end
37
37
 
38
38
  def promethee_data_translation_description
39
39
  data['components'].first['attributes']['searchable_description']
40
40
  rescue
41
- ""
41
+ ''
42
42
  end
43
43
 
44
44
 
@@ -52,19 +52,30 @@ module PrometheeData
52
52
  def promethee_extract_searchable(component)
53
53
  return '' if component.blank?
54
54
  searchable = ' '
55
- component['attributes'].each do |key, value|
55
+ searchable += promethee_extract_searchable_attributes component['attributes'] if component.include?('attributes')
56
+ # For masters, contents are in children
57
+ searchable += promethee_extract_searchable_children component['children'] if component.include? 'children'
58
+ # For translations, contents are in components, not children
59
+ searchable += promethee_extract_searchable_children component['components'] if component.include? 'components'
60
+ searchable
61
+ end
62
+
63
+ def promethee_extract_searchable_attributes(attributes)
64
+ searchable = ' '
65
+ attributes.each do |key, value|
56
66
  if key.starts_with? 'searchable_'
57
67
  clean_value = strip_tags value
58
68
  searchable += "#{clean_value} "
59
69
  end
60
- end if component.include? 'attributes'
61
- component['children'].each do |child|
62
- searchable += promethee_extract_searchable child
63
- end if component.include? 'children'
64
- # for translations
65
- component['components'].each do |child|
70
+ end
71
+ searchable
72
+ end
73
+
74
+ def promethee_extract_searchable_children(components)
75
+ searchable = ' '
76
+ components.each do |child|
66
77
  searchable += promethee_extract_searchable child
67
- end if component.include? 'components'
78
+ end
68
79
  searchable
69
80
  end
70
81
  end
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  </div>
15
15
  <div class="row">
16
- <div class="col-xs-12 collection-item-caption" ng-show="component.attributes.searchable_caption !== ''">Caption</div>
16
+ <div class="col-xs-12 collection-item-caption" ng-show="component.attributes.searchable_caption" ng-bind-html="component.attributes.searchable_caption | htmlSafe"></div>
17
17
  </div>
18
18
  </div>
19
19
  </div>
@@ -43,4 +43,4 @@
43
43
  }
44
44
  })
45
45
  }]);
46
- </script>
46
+ </script>
@@ -16,7 +16,7 @@
16
16
  <div class="row">
17
17
  <div class="col-md-6">
18
18
  <b>Body</b>
19
- <p>{{master.attributes.searchable_body}}</p>
19
+ <div ng-bind-html="master.attributes.searchable_body | htmlSafe"></div>
20
20
  </div>
21
21
  <div class="col-md-6">
22
22
  <div class="form-group">
@@ -11,26 +11,22 @@ class Promethee::Data::MasterLocalized < Promethee::Data
11
11
  protected
12
12
 
13
13
  def localize_component(component)
14
- localize_component_attributes component
15
- localize_component_children component
14
+ localize_component_attributes component if component.include?(:attributes)
15
+ localize_component_children component if component.include?(:children)
16
16
  end
17
17
 
18
18
  def localize_component_attributes(component)
19
- return unless component.include? :attributes
20
19
  localized_component = find_localized_component component[:id]
21
- return unless localized_component
22
- return unless localized_component.include? :attributes
20
+ return if (localized_component.nil? || !localized_component.include?(:attributes))
23
21
  component[:attributes].merge! localized_component[:attributes]
24
22
  end
25
23
 
26
24
  def localize_component_children(component)
27
- return unless component.include? :children
28
25
  component[:children].each { |child| localize_component child }
29
26
  end
30
27
 
31
28
  def find_localized_component(id)
32
- return if @localization.nil?
33
- return unless @localization.include? :components
29
+ return if @localization.nil? || !@localization.include?(:components)
34
30
  @localization[:components].find { |component| component[:id] == id }
35
31
  end
36
32
  end
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '1.7.1'
3
+ VERSION = '1.7.2'
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.7.1
4
+ version: 1.7.2
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: 2018-08-01 00:00:00.000000000 Z
17
+ date: 2018-08-02 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails