promethee 2.0.7 → 2.0.8

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
  SHA256:
3
- metadata.gz: 1bfa00024f6948324144223153ca8281d61c5f2b0dbc7c7400eabbabc35bec46
4
- data.tar.gz: 9773241dba38789dd987e323270c2e8a8f49fb224c7e63010554f57547631efe
3
+ metadata.gz: dc97d30606ee4b8e6a77b7186577d9dcf7fafde8c5f0d0ae22ffb0e1980cce01
4
+ data.tar.gz: bde68a84f5da02eae62c5246ee30753c596c6a1391415a8d0a53db2adbc0fcb3
5
5
  SHA512:
6
- metadata.gz: 5ac403751dc86682e9faabb169e67a37838f7adce5b931088827cc7e0fb7fc4cf1f3b244751393b035c97586caa5732bdb4a0014bf48c22c1ad369cfac9769af
7
- data.tar.gz: cb84e69a2280f3ba55e727e998dfb64a62c34413ed40d603cfe343624494072bb76cd5c096090947994cee5ce825fbe696e81fad5e0ca47bb5b7cfab8a740739
6
+ metadata.gz: d23868ae0d49e4356563727ad1dee9460b668ed8613c7aa9b095623e5fd02ab15796dbfde4095455797d9be21c3de530d1fe7a79b42efcc202f9a5a74594fa6c
7
+ data.tar.gz: 9feace9191db444cbf69f7fb96be2b88a4a084ad6ed67087b57d303121025cfec257747f7fe855767467eefb93c6427fc309669d12770a45fabf6d9873b9ddf8
@@ -3,10 +3,7 @@ searchable_caption = component[:attributes][:searchable_caption]
3
3
  media_type = component[:attributes][:media_type]
4
4
  case media_type
5
5
  when 'image'
6
- image_data = component[:attributes][:image]
7
- if image_data && image_data[:id]
8
- image_blob = ActiveStorage::Blob.find image_data[:id]
9
- end
6
+ image_blob = blob_from_data component[:attributes][:image]
10
7
  when 'video'
11
8
  url = component[:attributes][:video][:url].to_s
12
9
  if 'vimeo'.in? url
@@ -1,8 +1,5 @@
1
1
  <%
2
- image_data = component[:attributes][:image]
3
- if image_data && image_data[:id]
4
- blob = ActiveStorage::Blob.find image_data[:id]
5
- end
2
+ blob = blob_from_data component[:attributes][:image]
6
3
 
7
4
  searchable_surtitle = component[:attributes][:searchable_surtitle].to_s
8
5
  searchable_title = component[:attributes][:searchable_title].to_s
@@ -3,10 +3,7 @@ title = component[:attributes][:searchable_title].to_s
3
3
  body = component[:attributes][:searchable_body].to_s
4
4
  special_question = component[:attributes][:special_question]
5
5
 
6
- image = component[:attributes][:image]
7
- if image && image[:id]
8
- image_blob = ActiveStorage::Blob.find image[:id]
9
- end
6
+ image_blob = blob_from_data component[:attributes][:image]
10
7
  %>
11
8
 
12
9
  <div class="<%= promethee_class_for component %> <%= 'promethee__component__faq_item--special' if special_question %>">
@@ -1,8 +1,5 @@
1
1
  <%
2
- image_data = component[:attributes][:image]
3
- if image_data && image_data[:id]
4
- blob = ActiveStorage::Blob.find image_data[:id]
5
- end
2
+ blob = blob_from_data component[:attributes][:image]
6
3
 
7
4
  searchable_alt = component[:attributes][:searchable_alt].to_s
8
5
  searchable_caption = component[:attributes][:searchable_caption].to_s
@@ -8,10 +8,8 @@ has_background = !(background_color =~ /rgba\(\s*255\s*,\s*255\s*,\s*255\s*,\s*0
8
8
 
9
9
  if component[:attributes] && component[:attributes].has_key?(:backgrounds) # retro-compatibility
10
10
  component[:attributes][:backgrounds].each do |item|
11
- image_data = item[:image]
12
- if image_data && image_data[:id]
13
- blob_id = image_data[:id]
14
- blob = ActiveStorage::Blob.find blob_id
11
+ blob = blob_from_data item[:image]
12
+ if blob
15
13
  url = "url(#{url_for(blob)})"
16
14
  position = "#{item[:posh]} #{item[:posv]}"
17
15
  background_images << url
@@ -22,6 +20,7 @@ if component[:attributes] && component[:attributes].has_key?(:backgrounds) # ret
22
20
  end
23
21
  %>
24
22
 
25
- <div class="row <%= promethee_class_for component %><%= ' promethee__component__row--background' if has_background %>" style="background-color: <%= background_color %>; <%= background_images.count > 0 ? "background-repeat: no-repeat; background-image: #{background_images.join(', ')}; background-position: #{background_positions.join(', ')}; background-size: #{background_sizes.join(', ')};" : '' %>">
23
+ <div class="row <%= promethee_class_for component %><%= ' promethee__component__row--background' if has_background %>"
24
+ style="background-color: <%= background_color %>; <%= background_images.count > 0 ? "background-repeat: no-repeat; background-image: #{background_images.join(', ')}; background-position: #{background_positions.join(', ')}; background-size: #{background_sizes.join(', ')};" : '' %>">
26
25
  <%= render 'promethee/show/components', components: component[:children] %>
27
26
  </div>
@@ -3,10 +3,7 @@ media_type = component[:attributes][:media_type]
3
3
  searchable_caption = component[:attributes][:searchable_caption]
4
4
  case media_type
5
5
  when 'image'
6
- image_data = component[:attributes][:image]
7
- if image_data && image_data[:id]
8
- image_blob = ActiveStorage::Blob.find image_data[:id]
9
- end
6
+ image_blob = blob_from_data component[:attributes][:image]
10
7
  when 'video'
11
8
  url = component[:attributes][:video][:url].to_s
12
9
  if 'vimeo'.in? url
@@ -27,7 +24,7 @@ end
27
24
  <iframe frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="allowfullscreen" src="<%= iframe_src %>"></iframe>
28
25
  </div>
29
26
  <% elsif image_blob.present? %>
30
- <%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption: searchable_caption %>
27
+ <%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption: searchable_caption %>
31
28
  <% end %>
32
29
  <%= searchable_caption.to_s.html_safe %>
33
30
  </div>
@@ -38,6 +38,11 @@ module Promethee::Rails::Helper
38
38
  promethee_partials_for 'components/*/_localize.html.erb'
39
39
  end
40
40
 
41
+ def blob_from_data(blob_data = {})
42
+ return unless blob_data.has_key? :id
43
+ ActiveStorage::Blob.find_by(id: blob_data[:id])
44
+ end
45
+
41
46
  # promethee_bem_classes 'promethee-edit__move__droppable', '--{{type}}', '--first'
42
47
  # -> promethee-edit__move__droppable promethee-edit__move__droppable--{{type}} promethee-edit__move__droppable--{{type}}--first"
43
48
  def promethee_bem_classes(*args)
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '2.0.7'
3
+ VERSION = '2.0.8'
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: 2.0.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Gaya
@@ -14,22 +14,22 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-07-30 00:00:00.000000000 Z
17
+ date: 2019-09-30 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
21
21
  requirement: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: '5.2'
25
+ version: 5.2.3
26
26
  type: :runtime
27
27
  prerelease: false
28
28
  version_requirements: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: '5.2'
32
+ version: 5.2.3
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: angularjs-rails
35
35
  requirement: !ruby/object:Gem::Requirement