scrivito_section_widgets 0.0.4 → 0.0.8

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
  SHA1:
3
- metadata.gz: c5affc5d46f8c510e4855ba97acf632116f8402a
4
- data.tar.gz: 885af4fb52c5d5331ffc97060e67568170bfd608
3
+ metadata.gz: 616d63e48368d3f48eb4eb38edb6e6fd30dd675c
4
+ data.tar.gz: 41f608e0eb89408fd25f09f3916c14210fef2791
5
5
  SHA512:
6
- metadata.gz: fa369024944052c5e720956b6af46f33eca289ae0656069c36f74a554c5122bc1a123925c4564b02774a6f824cd5cf3d2a6f06be7dd1be0b0174fe6357740627
7
- data.tar.gz: b5df7e846f02ee924b9095a3d91a173dc7c72244855a60c465af21db986e4a4b0d2e2ec4906028721080405979b876d5211f5c0c5adde4cf0c21feb012ab3c7e
6
+ metadata.gz: 5771956349f3c1702c3d0c17cad8ae9624da23b251da23047e8c2078d039fd99ea580cf8d345fd3d71b6a41f3be6d743905ee8e8ad6d066cfa2a50cab191a87f
7
+ data.tar.gz: 9250834f2f8427ad44cceba2c6c6f528a2fd9bef7d83bf56aafae6b9a4464b66c1009aad9b57c52249341e8752c209778487e1f08e848e7109dc8a88198a3999
@@ -6,33 +6,36 @@ $(function(){
6
6
  || window.msRequestAnimationFrame
7
7
  || function(f){setTimeout(f, 1000/60)}
8
8
 
9
- var elems = [];
9
+ var elems = $(".parallax-image");
10
10
 
11
11
  if($('body').width() > 1024) {
12
- $(".parallax-image").each(function() {
13
- var elem = $(this);
14
-
15
- set_background_position(elem);
16
- set_dimension(elems);
17
-
18
- elems.push(elem);
19
- });
12
+ set_background_positions(elems);
20
13
 
21
14
  $(window).on('scroll', function(event) {
22
- window.requestAnimationFrame(function(){ set_background_positions(elems) });
23
- });
24
-
25
- $(window).on('resize', function(event) {
26
- window.requestAnimationFrame(function(){ set_dimension(elems) });
15
+ window.requestAnimationFrame(function(){ set_background_positions(elems); });
27
16
  });
17
+ } else {
18
+ set_dimension(elems);
28
19
  }
20
+
21
+ $(window).on('resize', function(event) {
22
+ set_dimension(elems);
23
+ });
29
24
  });
30
25
 
31
26
  function set_dimension(elems) {
32
27
  var height = 0;
28
+ var container = null;
29
+
33
30
  $.each(elems, function(i, elem) {
34
- height = $(elem).parents('.parallax').height();
35
- $(elem).css('height', height * 2);
31
+ container = $(elem).parents('.parallax');
32
+ height = $(elem).get(0).clientHeight / 1.3;
33
+
34
+ if(height > 0) {
35
+ container.css({
36
+ 'height': height,
37
+ });
38
+ }
36
39
  });
37
40
  }
38
41
 
@@ -59,5 +62,5 @@ function calulate_position(elem) {
59
62
  }
60
63
 
61
64
  function caluclate_offset(elem) {
62
- return window.pageYOffset - elem.offset().top;
65
+ return window.pageYOffset - $(elem).offset().top;
63
66
  }
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree ./scrivito_section_widgets
@@ -0,0 +1,65 @@
1
+ /* background colors */
2
+ .transparent {
3
+ background-color: transparent !important;
4
+ }
5
+
6
+ .black {
7
+ background-color: #33312d !important;
8
+ }
9
+
10
+ .gray {
11
+ background-color: #a0a0a0 !important;
12
+ }
13
+
14
+ .light-gray {
15
+ background-color: #eee !important;
16
+ }
17
+
18
+ .red {
19
+ background-color: #c5463f !important;
20
+ }
21
+
22
+ .green {
23
+ background-color: #439439 !important;
24
+ }
25
+
26
+ .blue {
27
+ background-color: #3f86ac !important;
28
+ }
29
+
30
+ .yellow {
31
+ background-color: #e1d00e !important;
32
+ }
33
+
34
+ /* icon colors */
35
+ i.transparent {
36
+ color: transparent !important;
37
+ }
38
+
39
+ i.black {
40
+ color: #33312d !important;
41
+ }
42
+
43
+ i.gray {
44
+ color: #a0a0a0 !important;
45
+ }
46
+
47
+ i.light-gray {
48
+ color: #eee !important;
49
+ }
50
+
51
+ i.red {
52
+ color: #c5463f !important;
53
+ }
54
+
55
+ i.green {
56
+ color: #439439 !important;
57
+ }
58
+
59
+ i.blue {
60
+ color: #3f86ac !important;
61
+ }
62
+
63
+ i.yellow {
64
+ color: #e1d00e !important;
65
+ }
@@ -8,9 +8,7 @@
8
8
  position: absolute;
9
9
  top: 0;
10
10
  width: 100%;
11
- height: 100vh;
12
- background-size: cover;
13
- background-position: center center;
11
+ height: auto;
14
12
  }
15
13
 
16
14
  .scrivito_section_video_widget video {
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require_tree ./scrivito_section_widgets
3
+ */
@@ -1,2 +1,15 @@
1
1
  class SectionContentWidget < Widget
2
+
3
+ def selectable_color_classes(class_name, attribute)
4
+ if Obj.respond_to?('selectable_color_classes')
5
+ Obj.selectable_color_classes(class_name, attribute)
6
+ else
7
+ IconBoxWidget.fallback_colors
8
+ end
9
+ end
10
+
11
+ private
12
+ def self.fallback_colors
13
+ %w(transparent black gray light-gray red green blue yellow)
14
+ end
2
15
  end
@@ -1,6 +1,6 @@
1
1
  <div class="details-view" >
2
2
  <h4>Background Color</h4>
3
- <%= scrivito_toggle_button_editor widget, :background_color, Obj.selectable_color_classes('scrivito_content_widget') do |text| %>
3
+ <%= scrivito_toggle_button_editor widget, :background_color, widget.selectable_color_classes('scrivito_content_widget', 'background_color') do |text| %>
4
4
  <% scrivito_tag(:button, widget, :background_color, class: text, data: {editor: 'scrivito-toggle-button', content: text}) do
5
5
  text
6
6
  end %>
@@ -1,4 +1,4 @@
1
- <section class="parallax scrivito_section_parallax_widget" style="height: <%= widget.height %>">
2
- <div class="parallax-image" style="background-image: url(<%= widget.background_image.try(:binary_url) %>)"></div>
1
+ <section class="parallax scrivito_section_parallax_widget" style="height: <%= widget.height %>; max-height: <%= widget.height %>">
2
+ <%= scrivito_image_tag widget, :background_image, class: "parallax-image" %>
3
3
  <%= scrivito_tag(:div, widget, :section_content, class: 'container') %>
4
4
  </section>
@@ -1,3 +1,3 @@
1
1
  module ScrivitoSectionWidgets
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -38,13 +38,15 @@ class CreateSectionWidgets < ::Scrivito::Migration
38
38
  ]
39
39
  )
40
40
 
41
- Scrivito::ObjClass.create(
42
- name: 'Video',
43
- type: 'generic',
44
- is_binary: true,
45
- title: 'Video',
46
- attributes: []
47
- )
41
+ unless Scrivito::ObjClass.all.to_a.select {|a| a.name == "Video"}.empty?
42
+ Scrivito::ObjClass.create(
43
+ name: 'Video',
44
+ type: 'generic',
45
+ is_binary: true,
46
+ title: 'Video',
47
+ attributes: []
48
+ )
49
+ end
48
50
 
49
51
  end
50
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_section_widgets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-20 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -50,11 +50,14 @@ files:
50
50
  - app/assets/images/section_content.png
51
51
  - app/assets/images/section_parallax.png
52
52
  - app/assets/images/section_video.png
53
+ - app/assets/javascripts/scrivito_section_widgets.js
53
54
  - app/assets/javascripts/scrivito_section_widgets/parallax.js
54
55
  - app/assets/javascripts/scrivito_section_widgets/scripts.js
55
56
  - app/assets/javascripts/scrivito_section_widgets/video_content_browser.js
56
57
  - app/assets/javascripts/scrivito_section_widgets/video_control.js
58
+ - app/assets/stylesheets/scrivito_section_widgets.css
57
59
  - app/assets/stylesheets/scrivito_section_widgets/bootstrap_sectionize.css
60
+ - app/assets/stylesheets/scrivito_section_widgets/colors.css
58
61
  - app/assets/stylesheets/scrivito_section_widgets/parallax_section.css
59
62
  - app/assets/stylesheets/scrivito_section_widgets/styles.css
60
63
  - app/models/section_content_widget.rb