scrivito_section_widgets 0.0.4 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/scrivito_section_widgets/parallax.js +20 -17
- data/app/assets/javascripts/scrivito_section_widgets.js +13 -0
- data/app/assets/stylesheets/scrivito_section_widgets/colors.css +65 -0
- data/app/assets/stylesheets/scrivito_section_widgets/parallax_section.css +1 -3
- data/app/assets/stylesheets/scrivito_section_widgets.css +3 -0
- data/app/models/section_content_widget.rb +13 -0
- data/app/views/section_content_widget/details.html.erb +1 -1
- data/app/views/section_parallax_widget/show.html.erb +2 -2
- data/lib/scrivito_section_widgets/version.rb +1 -1
- data/scrivito/migrate/0_create_section_widgets.rb +9 -7
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 616d63e48368d3f48eb4eb38edb6e6fd30dd675c
|
4
|
+
data.tar.gz: 41f608e0eb89408fd25f09f3916c14210fef2791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
35
|
-
$(elem).
|
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
|
+
}
|
@@ -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,
|
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
|
-
|
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>
|
@@ -38,13 +38,15 @@ class CreateSectionWidgets < ::Scrivito::Migration
|
|
38
38
|
]
|
39
39
|
)
|
40
40
|
|
41
|
-
Scrivito::ObjClass.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
+
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-
|
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
|