scrivito_slick_slider_widget 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +3 -0
  3. data/README.md +58 -0
  4. data/Rakefile +21 -0
  5. data/app/assets/images/scrivito_slick_slider_widget/ajax-loader.gif +0 -0
  6. data/app/assets/javascripts/scrivito_slick_slider_widget/application.js +41 -0
  7. data/app/assets/javascripts/scrivito_slick_slider_widget/editing.js +10 -0
  8. data/app/assets/stylesheets/scrivito_slick_slider_widget/application.scss +78 -0
  9. data/app/assets/stylesheets/scrivito_slick_slider_widget/editing.css +1 -0
  10. data/app/controllers/scrivito_slick_slider_widget/application_controller.rb +4 -0
  11. data/app/controllers/scrivito_slick_slider_widget/slick_slider_widget_controller.rb +17 -0
  12. data/app/helpers/scrivito_slick_slider_widget/application_helper.rb +4 -0
  13. data/app/models/slick_slider_panel_widget.rb +7 -0
  14. data/app/models/slick_slider_widget.rb +11 -0
  15. data/app/views/layouts/scrivito_slick_slider_widget/application.html.erb +14 -0
  16. data/app/views/slick_slider_panel_widget/show.html.erb +6 -0
  17. data/app/views/slick_slider_panel_widget/thumbnail.html.erb +11 -0
  18. data/app/views/slick_slider_widget/add_new_panel.html.erb +1 -0
  19. data/app/views/slick_slider_widget/details.html.erb +19 -0
  20. data/app/views/slick_slider_widget/show.html.erb +21 -0
  21. data/app/views/slick_slider_widget/thumbnail.html.erb +11 -0
  22. data/config/routes.rb +3 -0
  23. data/lib/scrivito_slick_slider_widget.rb +4 -0
  24. data/lib/scrivito_slick_slider_widget/engine.rb +5 -0
  25. data/lib/scrivito_slick_slider_widget/version.rb +3 -0
  26. data/lib/tasks/scrivito_slick_slider_widget_tasks.rake +4 -0
  27. data/scrivito/migrate/0_create_slick_slider_widget.rb +21 -0
  28. metadata +112 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0c537f481f73a1992dcdc06c29c9de17acb65198
4
+ data.tar.gz: 7788ca06a01ff1d8c020ad3838135e961920b822
5
+ SHA512:
6
+ metadata.gz: 669462a6b4bde0b9a82d33e0f501f723385be05d0fc9d5ba1bb6dbe3317136145d5864fb8593efc13af5d07cd3166225f8ea2a5b4edbe8e300e55d3cdb2097f0
7
+ data.tar.gz: fc8553fd5d9c8d5d17b4c137e74809deabbd9febecb61eb364a5956345830808a4cc875bf9d336e8d3af6bd19be505727925c12011b1a9c126b77e77edeb9829
data/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2009 - 2014 Infopark AG (http://www.infopark.com)
2
+ This software can be used and modified under the LGPL-3.0. Please refer to
3
+ http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # ScrivitoSlickSliderWidget
2
+
3
+ This Gem adds a Slick Slider to your Scrivito App. For details of the slider see http://kenwheeler.github.io/slick/
4
+
5
+
6
+ ## Prerequisites
7
+
8
+ Use Bootstrap in your Rails app (or modify the views for your needs).
9
+
10
+ ## Installation
11
+
12
+ Add the gem to your Gemfile
13
+
14
+ gem 'scrivito_slick_slider_widget'
15
+
16
+ Run bundle:
17
+
18
+ $ bundle
19
+
20
+ Add to your app/assets/javascript/editing.js:
21
+
22
+ //= require scrivito_slick_slider_widget/editing
23
+
24
+ Add to your javascript/application.js:
25
+
26
+ //= require slick_slider_widget/application
27
+
28
+ Add to stylesheet/editing.css:
29
+
30
+ *= require scrivito_slick_slider_widget/editing
31
+
32
+ Add to stylesheet/application.css:
33
+
34
+ *= require scrivito_slick_slider_widget/application
35
+
36
+ Add to the end of your application layout:
37
+ <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.3.11/slick.min.js"></script>
38
+
39
+ Run
40
+
41
+ $ rake scrivito:migrate:install
42
+ $ rake scrivito:migrate
43
+
44
+ Switch to your Workspace 'rtc' and follow below Steps for Usage. If you are happy with the outcome run
45
+
46
+ $ rake scrivito:migrate:publish
47
+
48
+ ## Steps for Usage
49
+
50
+ - Insert the Widget 'Slick Slider' somewhere in your content.
51
+ - Put some 'Slider Panels' widgets into it.
52
+ - For each of the Slider Panels: set an image reference and a link. The link title will be displayed underneath the image. The link destination is where the user is taken when clicking on any of the slider panels.
53
+
54
+ ## License
55
+
56
+ Copyright (c) 2009 - 2014 Infopark AG (http://www.infopark.com)
57
+
58
+ This software can be used and modified under the LGPL-3.0. Please refer to http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
data/Rakefile ADDED
@@ -0,0 +1,21 @@
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 = 'ScrivitoSlickSliderWidget'
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
+
20
+ Bundler::GemHelper.install_tasks
21
+
@@ -0,0 +1,41 @@
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 vendor/assets/javascripts of plugins, if any, 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 .
14
+
15
+ $(document).ready(function(){
16
+ $('.slick_slider_widget').slick({
17
+ infinite: true,
18
+ slidesToScroll: 1,
19
+ slidesToShow: 5,
20
+ autoplay: true,
21
+ autoplaySpeed: 3000,
22
+ dots: true,
23
+ responsive: [
24
+ {
25
+ breakpoint: 768,
26
+ settings: {
27
+ dots: false,
28
+ slidesToShow: 4
29
+ }
30
+ },
31
+ {
32
+ breakpoint: 480,
33
+ settings: {
34
+ arrows: false,
35
+ dots: false,
36
+ slidesToShow: 2
37
+ }
38
+ }
39
+ ]
40
+ });
41
+ });
@@ -0,0 +1,10 @@
1
+ $(".slick_slider_widget_add_new_panel").bind("click", function(e) {
2
+ e.preventDefault();
3
+ $.get("/scrivito_slick_slider_widget/add_new_panel?obj=" + scrivito.obj.current_page.id() + "&widget=" + $(this).attr("widgetid"), function(data) {
4
+ // better to not reload but only update current widget view
5
+ // then put focus on freshly added panel
6
+ location.reload();
7
+ });
8
+
9
+ });
10
+
@@ -0,0 +1,78 @@
1
+ /* slick-slider
2
+ ================================================== */
3
+
4
+ .slick-slider { position: relative; display: block; padding:0 20px; box-sizing: border-box;
5
+ -moz-box-sizing: border-box; -webkit-touch-callout: none;
6
+ -webkit-user-select: none; -khtml-user-select: none;
7
+ -moz-user-select: none; -ms-user-select: none;
8
+ user-select: none; -ms-touch-action: none;
9
+ -webkit-tap-highlight-color: transparent;
10
+ }
11
+
12
+ .slick-list { position: relative; overflow: hidden; display: block; margin: 0; padding: 0; }
13
+ .slick-list:focus { outline: none; }
14
+ .slick-loading .slick-list { background: white image-url('ajax-loader.gif') center center no-repeat; }
15
+ .slick-list.dragging { cursor: pointer; cursor: hand; }
16
+
17
+ .slick-slider .slick-list, .slick-track, .slick-slide, .slick-slide img {
18
+ -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0);
19
+ -ms-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0);
20
+ transform: translate3d(0, 0, 0);
21
+ }
22
+
23
+ .slick-track { position: relative; left: 0; top: 0; display: block; zoom: 1; }
24
+ .slick-track:before, .slick-track:after { content: ""; display: table; }
25
+ .slick-track:after { clear: both; }
26
+ .slick-loading .slick-track { visibility: hidden; }
27
+
28
+ .slick-slide { float: left; height: 100%; min-height: 1px; display: none; }
29
+ .slick-slide img { display: block; width:100px; height:100px; border-radius:50px; overflow:hidden; margin:0 auto;}
30
+ .slick-slide.slick-loading img { display: none; }
31
+ .slick-slide.dragging img { pointer-events: none; }
32
+ .slick-initialized .slick-slide { display: block; }
33
+ .slick-loading .slick-slide { visibility: hidden; }
34
+ .slick-vertical .slick-slide { display: block; height: auto; border: 1px solid transparent; }
35
+
36
+ /* Arrows */
37
+ .slick-prev, .slick-next { position: absolute; display: block; height: 40px; width: 30px;
38
+ line-height: 40px; font-size: 0; cursor: pointer; background: transparent;
39
+ color: transparent; top: 50%; margin-top: -10px; padding: 0; border: none; outline: none;
40
+ }
41
+ .slick-prev:hover, .slick-prev:focus, .slick-next:hover, .slick-next:focus { outline: none; background: transparent; color: transparent; }
42
+ .slick-prev:hover:before, .slick-prev:focus:before, .slick-next:hover:before, .slick-next:focus:before { opacity: 1; }
43
+ .slick-prev.slick-disabled:before, .slick-next.slick-disabled:before { opacity: 0.25; }
44
+
45
+ .slick-prev:before, .slick-next:before {
46
+ font-family: "foundation_icons_general_enclosed";
47
+ font-weight: normal;
48
+ font-style: normal;
49
+ text-decoration: inherit; color:#aaa;
50
+ font-size:33px; line-height: 1; opacity: 0.5; text-align:center;
51
+ vertical-align: middle; line-height: inherit;
52
+ -webkit-font-smoothing: antialiased;
53
+ -moz-osx-font-smoothing: grayscale;
54
+ }
55
+
56
+ .slick-prev { left: -5px; }
57
+ .slick-prev:before { content: "\f015"; }
58
+
59
+ .slick-next { right: -5px; }
60
+ .slick-next:before { content: "\f014"; }
61
+
62
+ /* Dots */
63
+ .slick-slider { margin-bottom: 20px; }
64
+
65
+ .slick-dots { position: absolute; bottom: -45px; list-style: none; display: block; text-align: center; padding: 0; width: 100%; }
66
+ .slick-dots li { position: relative; display: inline-block; height: 20px; width: 20px; margin: 0 5px; padding: 0; cursor: pointer; }
67
+ .slick-dots li button { border: 0; background: #fff; display: block;
68
+ height: 7px; width: 7px; outline: none; line-height: 0;
69
+ font-size: 0; color: transparent; padding: 0; cursor: pointer;
70
+ border-radius:50%;
71
+ }
72
+ .slick-dots li button:hover, .slick-dots li button:focus { outline: none; }
73
+ .slick-dots li button:hover:before, .slick-dots li button:focus:before { opacity: 1; }
74
+ .slick-dots li button:before { position: absolute; top: 0; left: 0; content: ""; width: 20px; height: 20px;
75
+ font-size: 6px; line-height: 20px; text-align: center; color: black; opacity: 0.25; }
76
+ .slick-dots li.slick-active button { background: #9ec7ac; }
77
+
78
+ .slider .h4 { text-align:center;}
@@ -0,0 +1 @@
1
+ .scrivito_editing_link {color: rgba(67, 148, 57, 1.0);}
@@ -0,0 +1,4 @@
1
+ module ScrivitoSlickSliderWidget
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,17 @@
1
+ module ScrivitoSlickSliderWidget
2
+
3
+ class SlickSliderWidgetController < CmsController
4
+
5
+ layout false
6
+
7
+ def add_new_panel
8
+ widget = Obj.find(params[:obj]).widget_from_pool(params[:widget])
9
+ widget.update(panels: widget.panels << SlickSliderPanelWidget.new())
10
+ #TODO: check for success and return appropriate result
11
+ render "slick_slider_widget/add_new_panel"
12
+ end
13
+
14
+ end
15
+
16
+ end
17
+
@@ -0,0 +1,4 @@
1
+ module ScrivitoSlickSliderWidget
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ class SlickSliderPanelWidget < Widget
2
+
3
+ def description_for_editor
4
+ "Slider Panel"
5
+ end
6
+
7
+ end
@@ -0,0 +1,11 @@
1
+ class SlickSliderWidget < Widget
2
+
3
+ def description_for_editor
4
+ "Slick Slider"
5
+ end
6
+
7
+ def self.valid_widget_classes_for(field_name)
8
+ %w[SlickSliderPanelWidget]
9
+ end
10
+
11
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>ScrivitoSlickSliderWidget</title>
5
+ <%= stylesheet_link_tag "scrivito_slick_slider_widget/application", media: "all" %>
6
+ <%= javascript_include_tag "scrivito_slick_slider_widget/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,6 @@
1
+ <div>
2
+ <a href="#">
3
+ <img class="img-responsive" alt="" src="http://localhost:3000/assets/scriv-uno/teaser_07.jpg">
4
+ <p class="h4">Dairy</p>
5
+ </a>
6
+ </div>
@@ -0,0 +1,11 @@
1
+ <div class="editing-dialog-thumbnail">
2
+ <div class="visualization">
3
+ <span class="icon editing-icon-slider"></span>
4
+ </div>
5
+ <div class="title">
6
+ Slider Panel
7
+ </div>
8
+ <div class="description">
9
+ Adds a panel to the Slick slider.
10
+ </div>
11
+ </div>
@@ -0,0 +1 @@
1
+ <!-- JS code for refreshing page part and activating new added panel? -->
@@ -0,0 +1,19 @@
1
+ <% widget.panels.each_with_index do |panel, index| %>
2
+ <% unless index == 0 %>
3
+ <hr />
4
+ <% end %>
5
+ <div class="row">
6
+ <div class="col-md-4">
7
+ <%= scrivito_image_tag(panel, :image, style: "max-height: 100px; max-width: 250px; margin-bottom: 1em;") %>
8
+ </div>
9
+ <div class="col-md-8">
10
+ <%= scrivito_edit_link(panel, :link, data: {placeholder: "Where should the button take the user ..."}) %>
11
+ </div>
12
+ </div>
13
+ <% end %>
14
+ <hr />
15
+ <!-- div class="add_new_panel">
16
+ <p>
17
+ <a id="slick_slider_widget_add_new_panel" href="#" widgetid="<%= widget.id %>" class="scrivito_editing_link">Add New Slider Panel</a>
18
+ </p>
19
+ </div -->
@@ -0,0 +1,21 @@
1
+ <div class="slider slick_slider_widget">
2
+ <% widget.panels.each do |p| %>
3
+ <div>
4
+ <% if p.link.present? %>
5
+ <%= link_to scrivito_path(p.link) do %>
6
+ <%= scrivito_image_tag p, :image %>
7
+ <p class="h4"><%= p.link.title %></p>
8
+ <% end %>
9
+ <% else %>
10
+ <%= scrivito_image_tag p, :image %>
11
+ <% end %>
12
+ </div>
13
+ <% end %>
14
+
15
+ <% if scrivito_in_editable_view? %>
16
+ <div class="add_new_panel">
17
+ <p class="h4"><a class="slick_slider_widget_add_new_panel scrivito_editing_link" href="#" widgetid="<%= widget.id %>">Add New<br />Slider Panel</a></p>
18
+ </div>
19
+ <% end %>
20
+
21
+ </div>
@@ -0,0 +1,11 @@
1
+ <div class="editing-dialog-thumbnail">
2
+ <div class="visualization">
3
+ <span class="icon editing-icon-slider"></span>
4
+ </div>
5
+ <div class="title">
6
+ Slick Slider
7
+ </div>
8
+ <div class="description">
9
+ Creates a highly adaptive slider.
10
+ </div>
11
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ get '/scrivito_slick_slider_widget/add_new_panel', to: 'scrivito_slick_slider_widget/slick_slider_widget#add_new_panel'
3
+ end
@@ -0,0 +1,4 @@
1
+ require "scrivito_slick_slider_widget/engine"
2
+
3
+ module ScrivitoSlickSliderWidget
4
+ end
@@ -0,0 +1,5 @@
1
+ module ScrivitoSlickSliderWidget
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace ScrivitoSlickSliderWidget
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module ScrivitoSlickSliderWidget
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :scrivito_slick_slider_widget do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,21 @@
1
+ class CreateSlickSliderWidget < ::Scrivito::Migration
2
+ def up
3
+ Scrivito::ObjClass.create(
4
+ name: 'SlickSliderWidget',
5
+ type: 'publication',
6
+ title: 'Slick Slider',
7
+ attributes: [
8
+ {name: 'panels', type: :widget},
9
+ ]
10
+ )
11
+ Scrivito::ObjClass.create(
12
+ name: 'SlickSliderPanelWidget',
13
+ type: 'publication',
14
+ title: 'Slick Slider Panel',
15
+ attributes: [
16
+ {name: 'image', type: :reference},
17
+ {name: 'link', type: :link},
18
+ ]
19
+ )
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrivito_slick_slider_widget
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Scrivito
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.1.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: scrivito
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.30.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.30.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Scrivito Widget for a bootstrap-style Slick Slider.
56
+ email:
57
+ - support@scrivito.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - LICENSE
63
+ - README.md
64
+ - Rakefile
65
+ - app/assets/images/scrivito_slick_slider_widget/ajax-loader.gif
66
+ - app/assets/javascripts/scrivito_slick_slider_widget/application.js
67
+ - app/assets/javascripts/scrivito_slick_slider_widget/editing.js
68
+ - app/assets/stylesheets/scrivito_slick_slider_widget/application.scss
69
+ - app/assets/stylesheets/scrivito_slick_slider_widget/editing.css
70
+ - app/controllers/scrivito_slick_slider_widget/application_controller.rb
71
+ - app/controllers/scrivito_slick_slider_widget/slick_slider_widget_controller.rb
72
+ - app/helpers/scrivito_slick_slider_widget/application_helper.rb
73
+ - app/models/slick_slider_panel_widget.rb
74
+ - app/models/slick_slider_widget.rb
75
+ - app/views/layouts/scrivito_slick_slider_widget/application.html.erb
76
+ - app/views/slick_slider_panel_widget/show.html.erb
77
+ - app/views/slick_slider_panel_widget/thumbnail.html.erb
78
+ - app/views/slick_slider_widget/add_new_panel.html.erb
79
+ - app/views/slick_slider_widget/details.html.erb
80
+ - app/views/slick_slider_widget/show.html.erb
81
+ - app/views/slick_slider_widget/thumbnail.html.erb
82
+ - config/routes.rb
83
+ - lib/scrivito_slick_slider_widget.rb
84
+ - lib/scrivito_slick_slider_widget/engine.rb
85
+ - lib/scrivito_slick_slider_widget/version.rb
86
+ - lib/tasks/scrivito_slick_slider_widget_tasks.rake
87
+ - scrivito/migrate/0_create_slick_slider_widget.rb
88
+ homepage: https://www.scrivito.com
89
+ licenses:
90
+ - LGPL-3.0
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.4.2
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Scrivito Widget for a bootstrap-style Slick Slider.
112
+ test_files: []