scrivito_section_widgets 0.0.1

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.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +4 -0
  3. data/Rakefile +20 -0
  4. data/app/assets/images/section_content.png +0 -0
  5. data/app/assets/images/section_parallax.png +0 -0
  6. data/app/assets/images/section_video.png +0 -0
  7. data/app/assets/javascripts/scrivito_section_widgets/parallax.js +33 -0
  8. data/app/assets/javascripts/scrivito_section_widgets/scripts.js +13 -0
  9. data/app/assets/javascripts/scrivito_section_widgets/video_content_browser.js +7 -0
  10. data/app/assets/javascripts/scrivito_section_widgets/video_control.js +33 -0
  11. data/app/assets/stylesheets/scrivito_section_widgets/bootstrap_sectionize.css +45 -0
  12. data/app/assets/stylesheets/scrivito_section_widgets/parallax_section.css +23 -0
  13. data/app/assets/stylesheets/scrivito_section_widgets/styles.css +15 -0
  14. data/app/models/section_content_widget.rb +2 -0
  15. data/app/models/section_parallax_widget.rb +2 -0
  16. data/app/models/section_video_widget.rb +2 -0
  17. data/app/models/video.rb +2 -0
  18. data/app/views/section_content_widget/details.html.erb +8 -0
  19. data/app/views/section_content_widget/show.html.erb +3 -0
  20. data/app/views/section_content_widget/thumbnail.html.erb +11 -0
  21. data/app/views/section_parallax_widget/details.html.erb +7 -0
  22. data/app/views/section_parallax_widget/show.html.erb +3 -0
  23. data/app/views/section_parallax_widget/thumbnail.html.erb +11 -0
  24. data/app/views/section_video_widget/details.html.erb +16 -0
  25. data/app/views/section_video_widget/show.html.erb +14 -0
  26. data/app/views/section_video_widget/thumbnail.html.erb +11 -0
  27. data/app/views/video/details.html.erb +15 -0
  28. data/lib/scrivito_section_widgets/engine.rb +5 -0
  29. data/lib/scrivito_section_widgets/version.rb +3 -0
  30. data/lib/scrivito_section_widgets.rb +4 -0
  31. data/lib/tasks/scrivito_section_widgets_tasks.rake +4 -0
  32. data/scrivito/migrate/0_create_section_widgets.rb +50 -0
  33. metadata +103 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 94c46ee676623f6c048799e29e5d9d676d5257ae
4
+ data.tar.gz: 6e03a2ebb3d02d5940735d334879b681507ec05d
5
+ SHA512:
6
+ metadata.gz: ffb70f685617ffe9bce8dcc4f4b13b409096cb01cddeeb46ef4885ce7e1e5c4f61b53af39393ad90e30daab6f7efe884a4f6868ec3e762bac478ba594aed3039
7
+ data.tar.gz: bc3dde259750f09290b5a7c9241f3dbc8fc1b93ddb575740bd38eda9cc3fb594896b7712bcb1d36d2a8610a7827625658be0066b255aede4a229458d7f86e0f6
data/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ Copyright (c) 2009 - 2014 Infopark AG (http://www.infopark.com)
2
+
3
+ This software can be used and modified under the LGPL-3.0. Please refer to
4
+ http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'ScrivitoSectionWidgets'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+ Bundler::GemHelper.install_tasks
20
+
Binary file
@@ -0,0 +1,33 @@
1
+ (function($, App) {
2
+ 'use strict';
3
+
4
+ $(function() {
5
+ if($('body').width() > 1024) {
6
+ var elems = $(".parallax");
7
+ set_background_positions(elems);
8
+
9
+ $(window).scroll(function(event) {
10
+ set_background_positions(elems);
11
+ });
12
+ }
13
+ });
14
+ })(jQuery, this);
15
+
16
+ function set_background_positions(elems) {
17
+ $.each(elems, function(i, elem) {
18
+ set_background_position(elem);
19
+ });
20
+ }
21
+
22
+ function set_background_position(elem) {
23
+ $(elem).css('background-position', calulate_position(elem));
24
+ }
25
+
26
+ function calulate_position(elem) {
27
+ var speed = 0.5;
28
+ return "50% " + (caluclate_offset(elem) * speed) + "px";
29
+ }
30
+
31
+ function caluclate_offset(elem) {
32
+ return $(document).scrollTop() - $(elem).offset().top;
33
+ }
@@ -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 .
@@ -0,0 +1,7 @@
1
+ $(function() {
2
+ scrivito.register_default_obj_class_for_content_type({
3
+ 'video/mp4': 'Video',
4
+ 'video/ogg': 'Video',
5
+ 'video/webm': 'Video'
6
+ })
7
+ });
@@ -0,0 +1,33 @@
1
+ (function($, App) {
2
+ 'use strict';
3
+
4
+ $(function() {
5
+ var videos = $(".video-tag");
6
+
7
+ $('body').on('click', '.scrivito_section_video_widget', function() {
8
+ var video = $(this).find('.parallax-video').get(0);
9
+ event.preventDefault();
10
+ if(video.paused){
11
+ video.play();
12
+ } else {
13
+ video.pause();
14
+ }
15
+ });
16
+
17
+ $.each(videos, function(index, elem) {
18
+ var mp4 = $(elem).data('source-mp4');
19
+ var ogg = $(elem).data('source-ogg');
20
+ var webm = $(elem).data('source-webm');
21
+ var image = $(elem).data('image');
22
+ var height = $(elem).data('height');
23
+ $(elem).html("");
24
+ if($('body').width() < 1025) {
25
+ $(elem).css({"background-image": "url("+ image +")", "height": height});
26
+ } else {
27
+ $(elem).append($('<video class="embed-responsive-item parallax-video" autoplay loop></video>').append("<source src='"+ mp4 +"' type='video/mp4'>").append("<source src='"+ webm +"' type='video/webm'>").append("<source src='"+ ogg +"' type='video/ogg'>"));
28
+ $(elem).find('video').get(0).play();
29
+ }
30
+ });
31
+ });
32
+
33
+ })(jQuery, this);
@@ -0,0 +1,45 @@
1
+ .container {
2
+ width: 100%;
3
+ padding: 0;
4
+ margin: 0;
5
+ }
6
+
7
+ #wrap > .container {
8
+ overflow: hidden;
9
+ }
10
+
11
+ section .container {
12
+ width: 100%;
13
+ padding: 15px;
14
+ margin: 0 auto;
15
+ }
16
+
17
+ @media (min-width: 768px) {
18
+ .container {
19
+ width: 100%;
20
+ }
21
+
22
+ section .container {
23
+ width: 750px;
24
+ }
25
+ }
26
+
27
+ @media (min-width: 992px) {
28
+ .container {
29
+ width: 100%;
30
+ }
31
+
32
+ section .container {
33
+ width: 970px;
34
+ }
35
+ }
36
+
37
+ @media (min-width: 1220px) {
38
+ .container {
39
+ width: 100%;
40
+ }
41
+
42
+ section .container {
43
+ width: 1170px;
44
+ }
45
+ }
@@ -0,0 +1,23 @@
1
+ .scrivito_section_parallax_widget {
2
+ background-size: cover;
3
+ }
4
+
5
+ .scrivito_section_video_widget video {
6
+ width: 100%;
7
+ display: block;
8
+ }
9
+
10
+ .scrivito_section_video_widget .container {
11
+ position: absolute;
12
+ top: 0;
13
+ left: 0;
14
+ right: 0;
15
+ }
16
+
17
+ .scrivito_section_parallax_widget .overlay {
18
+ position: absolute;
19
+ top: 0;
20
+ left: 0;
21
+ right: 0;
22
+ bottom: 0;
23
+ }
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,2 @@
1
+ class SectionContentWidget < Widget
2
+ end
@@ -0,0 +1,2 @@
1
+ class SectionParallaxWidget < Widget
2
+ end
@@ -0,0 +1,2 @@
1
+ class SectionVideoWidget < Widget
2
+ end
@@ -0,0 +1,2 @@
1
+ class Video
2
+ end
@@ -0,0 +1,8 @@
1
+ <div class="details-view" >
2
+ <h4>Background Color</h4>
3
+ <%= scrivito_toggle_button_editor widget, :background_color, Obj.selectable_color_classes('scrivito_content_widget') do |text| %>
4
+ <% scrivito_tag(:button, widget, :background_color, class: text, data: {editor: 'scrivito-toggle-button', content: text}) do
5
+ text
6
+ end %>
7
+ <% end %>
8
+ </div>
@@ -0,0 +1,3 @@
1
+ <section class="scrivito_section_content_widget <%= widget.background_color %>">
2
+ <%= scrivito_tag(:div, widget, :section_content, class: 'container') %>
3
+ </section>
@@ -0,0 +1,11 @@
1
+ <div class="scrivito_editing_widget_visualization">
2
+ <%= image_tag("section_content.png") %>
3
+ </div>
4
+
5
+ <div class="scrivito_editing_widget_title">
6
+ Section for content
7
+ </div>
8
+
9
+ <div class="scrivito_editing_widget_description">
10
+ Add a section for your content. A Section can have a Background color to seperate some content.
11
+ </div>
@@ -0,0 +1,7 @@
1
+ <div class="details-view" >
2
+ <h4>Background Image</h4>
3
+ <%= scrivito_tag(:div, widget, :background_image) %>
4
+
5
+ <h4>Height</h4>
6
+ <%= scrivito_tag(:div, widget, :height) %>
7
+ </div>
@@ -0,0 +1,3 @@
1
+ <section class="parallax scrivito_section_parallax_widget" style="background-image: url(<%= widget.background_image.try(:binary_url) %>); height: <%= widget.height %>">
2
+ <%= scrivito_tag(:div, widget, :section_content, class: 'container') %>
3
+ </section>
@@ -0,0 +1,11 @@
1
+ <div class="scrivito_editing_widget_visualization">
2
+ <%= image_tag("section_parallax.png") %>
3
+ </div>
4
+
5
+ <div class="scrivito_editing_widget_title">
6
+ Parallax Section
7
+ </div>
8
+
9
+ <div class="scrivito_editing_widget_description">
10
+ Add an image with parallax effect.
11
+ </div>
@@ -0,0 +1,16 @@
1
+ <div class="details-view" >
2
+ <h4>MP4 Video</h4>
3
+ <%= scrivito_tag(:div, widget, :background_video_mp4) %>
4
+
5
+ <h4>Webm Video</h4>
6
+ <%= scrivito_tag(:div, widget, :background_video_webm) %>
7
+
8
+ <h4>Ogg Video</h4>
9
+ <%= scrivito_tag(:div, widget, :background_video_ogg) %>
10
+
11
+ <h4>Background Image (Will be used if small screen, no video tag or no java script)</h4>
12
+ <%= scrivito_tag(:div, widget, :background_image) %>
13
+
14
+ <h4>Height (Used if image is visible)</h4>
15
+ <%= scrivito_tag(:div, widget, :height) %>
16
+ </div>
@@ -0,0 +1,14 @@
1
+ <section class="scrivito_section_video_widget">
2
+ <div
3
+ class="video-tag"
4
+ data-source-mp4="<%= widget.background_video_mp4.try(:binary_url) %>"
5
+ data-source-ogg="<%= widget.background_video_ogg.try(:binary_url) %>"
6
+ data-source-webm="<%= widget.background_video_webm.try(:binary_url) %>"
7
+ data-image="<%= widget.background_image.try(:binary_url) %>"
8
+ data-height="<%= widget.height %>">
9
+ <div class="parallax" style="height: <%= widget.height %>; background-image: url(<%= widget.background_image.try(:binary_url) %>)">
10
+ </div>
11
+ </div>
12
+ <%= scrivito_tag(:div, widget, :section_content, class: 'container') %>
13
+ <div class="overlay"></div>
14
+ </section>
@@ -0,0 +1,11 @@
1
+ <div class="scrivito_editing_widget_visualization">
2
+ <%= image_tag("section_video.png") %>
3
+ </div>
4
+
5
+ <div class="scrivito_editing_widget_title">
6
+ Video Section
7
+ </div>
8
+
9
+ <div class="scrivito_editing_widget_description">
10
+ Add a background Video as section to your page.
11
+ </div>
@@ -0,0 +1,15 @@
1
+ <div class="details-view">
2
+ <div class="video-wrapper">
3
+ <video class="embed-responsive-item" controls="<%= true %>">
4
+ <% if @obj.name.ends_with? '.mp4' %>
5
+ <source src="<%= @obj.try(:binary_url) %>" type="video/mp4"></source>
6
+ <% end %>
7
+ <% if @obj.name.ends_with? '.webm' %>
8
+ <source src="<%= @obj.try(:binary_url) %>" type="video/webm"></source>
9
+ <% end %>
10
+ <% if @obj.name.ends_with? '.ogg' %>
11
+ <source src="<%= @obj.try(:binary_url) %>" type="video/ogg"></source>
12
+ <% end %>
13
+ </video>
14
+ </div>
15
+ </div>
@@ -0,0 +1,5 @@
1
+ module ScrivitoSectionWidgets
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace ScrivitoSectionWidgets
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module ScrivitoSectionWidgets
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "scrivito_section_widgets/engine"
2
+
3
+ module ScrivitoSectionWidgets
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :scrivito_section_widgets do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,50 @@
1
+ class CreateSectionWidgets < ::Scrivito::Migration
2
+ def up
3
+ Scrivito::ObjClass.create(
4
+ name: 'SectionContentWidget',
5
+ type: 'publication',
6
+ is_binary: false,
7
+ title: 'Section Content Widget',
8
+ attributes: [
9
+ {name: "section_content", type: "widget"},
10
+ {name: "background_color", type: "string"}
11
+ ]
12
+ )
13
+
14
+ Scrivito::ObjClass.create(
15
+ name: 'SectionParallaxWidget',
16
+ type: 'publication',
17
+ is_binary: false,
18
+ title: 'Section Content Widget',
19
+ attributes: [
20
+ {name: "section_content", type: "widget"},
21
+ {name: "background_image", type: "reference"},
22
+ {name: "height", type: "string"}
23
+ ]
24
+ )
25
+
26
+ Scrivito::ObjClass.create(
27
+ name: 'SectionVideoWidget',
28
+ type: 'publication',
29
+ is_binary: false,
30
+ title: 'Section Content Widget',
31
+ attributes: [
32
+ {name: "section_content", type: "widget"},
33
+ {name: "background_video_mp4", type: "reference"},
34
+ {name: "background_video_webm", type: "reference"},
35
+ {name: "background_video_ogg", type: "reference"},
36
+ {name: "background_image", type: "reference"},
37
+ {name: "height", type: "reference"},
38
+ ]
39
+ )
40
+
41
+ Scrivito::ObjClass.create(
42
+ name: 'Video',
43
+ type: 'generic',
44
+ is_binary: true,
45
+ title: 'Video',
46
+ attributes: []
47
+ )
48
+
49
+ end
50
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrivito_section_widgets
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Scrivito
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: scrivito_sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Add sections to yout page
42
+ email:
43
+ - support@scrivito.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - LICENSE
49
+ - Rakefile
50
+ - app/assets/images/section_content.png
51
+ - app/assets/images/section_parallax.png
52
+ - app/assets/images/section_video.png
53
+ - app/assets/javascripts/scrivito_section_widgets/parallax.js
54
+ - app/assets/javascripts/scrivito_section_widgets/scripts.js
55
+ - app/assets/javascripts/scrivito_section_widgets/video_content_browser.js
56
+ - app/assets/javascripts/scrivito_section_widgets/video_control.js
57
+ - app/assets/stylesheets/scrivito_section_widgets/bootstrap_sectionize.css
58
+ - app/assets/stylesheets/scrivito_section_widgets/parallax_section.css
59
+ - app/assets/stylesheets/scrivito_section_widgets/styles.css
60
+ - app/models/section_content_widget.rb
61
+ - app/models/section_parallax_widget.rb
62
+ - app/models/section_video_widget.rb
63
+ - app/models/video.rb
64
+ - app/views/section_content_widget/details.html.erb
65
+ - app/views/section_content_widget/show.html.erb
66
+ - app/views/section_content_widget/thumbnail.html.erb
67
+ - app/views/section_parallax_widget/details.html.erb
68
+ - app/views/section_parallax_widget/show.html.erb
69
+ - app/views/section_parallax_widget/thumbnail.html.erb
70
+ - app/views/section_video_widget/details.html.erb
71
+ - app/views/section_video_widget/show.html.erb
72
+ - app/views/section_video_widget/thumbnail.html.erb
73
+ - app/views/video/details.html.erb
74
+ - lib/scrivito_section_widgets.rb
75
+ - lib/scrivito_section_widgets/engine.rb
76
+ - lib/scrivito_section_widgets/version.rb
77
+ - lib/tasks/scrivito_section_widgets_tasks.rake
78
+ - scrivito/migrate/0_create_section_widgets.rb
79
+ homepage: https://www.scrivito.com
80
+ licenses:
81
+ - LGPL-3.0
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.2.2
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Add sections to yout page
103
+ test_files: []