scrivito_elastic_slider_widget 0.92.0 → 0.92.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: 01ca99f1f6533ec6dbbb4942e87319eef06e1136
4
- data.tar.gz: 08c914aa9db2bb257c5f9dd96823f2f0f471002f
3
+ metadata.gz: f358b84072c49b0812b7443c3e739dc9ba6cabf1
4
+ data.tar.gz: 21e7ee125288295573f01222f50c10945807c05e
5
5
  SHA512:
6
- metadata.gz: f1db4b083c58a0c8dab2e4a1cd691a68a833cb192873dae7029e0144d9772e1c57a4b990843f0905fec8f0695e576b5264e64618198459eb6dd6f5973d159ef7
7
- data.tar.gz: 40c3e602d7888983fdaaf5aec613a751eb760ac5c5e312a6b4841a9c3edaa8a97d22593c486b26b91e01064f766bf66eaee0d582dec48b815df06162243da4fc
6
+ metadata.gz: 22e118cc3c23136e79ea2bc8d8768cceef9e490916f47b4bc7d3ecb01c9ea49984c65ff16c27024b726407528ee196b907344232882fd1a750828d083433a688
7
+ data.tar.gz: 8e171200c37b82bcda81c29991671fae88151541c5fcc0bbc4030a68e01a1adc66e9a17f82c95745bd4e0b26ecec0dfde819ab4508ae13ee965ed90dcecfcdf3
@@ -17,4 +17,22 @@ class ElasticSliderPanelWidget < Widget
17
17
  [ElasticSliderWidget]
18
18
  end
19
19
 
20
+ def transform_for_desktop(width)
21
+ if container.slider_height.to_i > 100
22
+ image.binary.transform(width: width, height: self.height, fit: :crop, crop: :center)
23
+ else
24
+ image.binary.transform(width: width)
25
+ end
26
+ end
27
+
28
+ def fallback_transform
29
+ if container.slider_height.to_i > 100
30
+ return { width: 1920, height: self.height, fit: :crop, crop: :center }
31
+ end
32
+ end
33
+
34
+ def height
35
+ h = container.slider_height.to_i
36
+ h > 100 ? h+200 : image.meta_data[:height] # 50vh, 100vh is dynamic, no height calculation possible
37
+ end
20
38
  end
@@ -1,5 +1,22 @@
1
1
  <div class="item <%= widget.additional_classes(params) %>">
2
- <%= scrivito_image_tag widget, :image %>
2
+ <picture>
3
+ <source media='(max-width: 400px) and (orientation: portrait)'
4
+ sizes='100vw'
5
+ srcset='<%= widget.image.binary.transform(width: 400, height: widget.height, fit: :crop, crop: :center).url %>'>
6
+
7
+ <source media='(max-width: 768px)'
8
+ sizes='100vw'
9
+ srcset='<%= widget.image.binary.transform(width: 768, height: widget.height, fit: :crop, crop: :center).url %>'>
10
+
11
+ <source media='(min-width: 668px) and (max-width: 991px)'
12
+ sizes='100vw'
13
+ srcset='<%= widget.transform_for_desktop(991).url %>'>
14
+
15
+ <source media='(min-width: 991px) and (max-width: 1200px)'
16
+ sizes='100vw'
17
+ srcset='<%= widget.transform_for_desktop(1200).url %>'>
18
+ <%= scrivito_image_tag widget, :image, {class: 'img-responsive'}, transform: widget.fallback_transform %>
19
+ </picture>
3
20
  <div class="carousel-caption">
4
21
  <div class="content">
5
22
  <%= scrivito_tag :div, widget, :panel_content %>
@@ -5,4 +5,4 @@
5
5
 
6
6
  <h3>Panels</h3>
7
7
  <%= scrivito_tag :div, widget, :panels %>
8
- <% end %>
8
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module ScrivitoElasticSliderWidget
2
- VERSION = "0.92.0"
2
+ VERSION = "0.92.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_elastic_slider_widget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.92.0
4
+ version: 0.92.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-07 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.4.5
97
+ rubygems_version: 2.5.1
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: A Widget for Scrivito delivering an Elastic Slider.