spree_slider 1.1.0 → 1.2.0
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.
- data/.gitignore +2 -1
- data/Gemfile +13 -6
- data/Versionfile +1 -9
- data/app/models/spree/slide.rb +1 -1
- data/app/overrides/spree/admin/configurations/index/add_slides_to_admin_configurations_menu.html.erb.deface +5 -0
- data/app/overrides/spree/admin/shared/_configuration_menu/add_slides_to_admin_configurations_sidebar_menu.html.erb.deface +2 -0
- data/app/overrides/spree/home/index/add_slider.html.erb.deface +4 -0
- data/app/overrides/spree/layouts/spree_application/add_slider.html.erb.deface +2 -0
- data/app/views/spree/admin/slides/_form.html.erb +4 -1
- data/app/views/spree/admin/slides/index.html.erb +2 -0
- data/app/views/spree/admin/slides/show.html.erb +6 -0
- data/config/locales/de.yml +3 -0
- data/config/locales/en.yml +2 -4
- data/config/locales/es.yml +3 -0
- data/config/locales/nl-NL.yml +3 -0
- data/config/locales/nl.yml +3 -0
- data/db/migrate/20120816192758_add_position_to_slides.rb +5 -0
- data/lib/generators/spree_slider/install_simple_carousel_generator.rb +30 -0
- data/lib/generators/spree_slider/templates/anything_slider.html.erb +1 -1
- data/lib/generators/spree_slider/templates/nivo_slider.html.erb +2 -2
- data/lib/generators/spree_slider/templates/simple_carousel_slider.html.erb +15 -0
- data/lib/spree_slider/engine.rb +2 -3
- data/spec/spec_helper.rb +12 -23
- data/spree_slider.gemspec +2 -8
- data/vendor/assets/simple-carousel/readme.txt +6 -0
- data/vendor/assets/simple-carousel/simple.carousel.js +144 -0
- data/vendor/assets/simple-carousel/simple.carousel.slider.js +14 -0
- metadata +18 -88
- data/Gemfile.lock +0 -175
- data/app/overrides/add_slider_to_layout.rb +0 -8
- data/app/overrides/add_slides_to_admin_configurations_menu.rb +0 -9
- data/app/overrides/add_slides_to_admin_configurations_sidebar_menu.rb +0 -7
- data/app/views/spree/home/index.html.erb +0 -14
- data/vendor/assets/anything-slider/demos.html +0 -740
- data/vendor/assets/anything-slider/demos/colorbox/border.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/colorbox.css +0 -62
- data/vendor/assets/anything-slider/demos/colorbox/controls.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomCenter.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopCenter.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox-min.js +0 -4
- data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox.js +0 -769
- data/vendor/assets/anything-slider/demos/colorbox/loading.gif +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/loading_background.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/overlay.png +0 -0
- data/vendor/assets/anything-slider/demos/css/page.css +0 -148
- data/vendor/assets/anything-slider/demos/images/251356.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/apple-touch-icon.png +0 -0
- data/vendor/assets/anything-slider/demos/images/favicon.ico +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-civil-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-civil-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-env-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-env-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-tele-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-tele-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-civil-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-civil-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-env-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-env-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/js/demo.js +0 -132
- data/vendor/assets/anything-slider/demos/video/movie.mp4 +0 -0
- data/vendor/assets/anything-slider/demos/video/movie.ogg +0 -0
- data/vendor/assets/anything-slider/demos/video/movie.webm +0 -0
- data/vendor/assets/anything-slider/expand.html +0 -97
- data/vendor/assets/anything-slider/index.html +0 -470
- data/vendor/assets/anything-slider/simple.html +0 -79
- data/vendor/assets/anything-slider/video.html +0 -341
- data/vendor/assets/nivo-slider/demo/demo.html +0 -39
- data/vendor/assets/nivo-slider/demo/images/dev7logo.png +0 -0
- data/vendor/assets/nivo-slider/demo/images/nemo.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/toystory.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/up.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/walle.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/scripts/jquery-1.6.1.min.js +0 -18
- data/vendor/assets/nivo-slider/demo/style.css +0 -100
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
group :test do
|
4
|
-
gem '
|
5
|
-
|
4
|
+
gem 'rspec-rails', '~> 2.11.0'
|
5
|
+
gem 'factory_girl', '~> 2.6.4'
|
6
|
+
gem 'factory_girl_rails', '~> 1.7'
|
7
|
+
gem 'faker'
|
8
|
+
gem 'shoulda-matchers'
|
9
|
+
gem 'guard-rspec'
|
10
|
+
gem 'sqlite3'
|
6
11
|
|
7
|
-
if
|
8
|
-
|
9
|
-
|
10
|
-
|
12
|
+
if RUBY_PLATFORM.downcase.include? "darwin"
|
13
|
+
gem 'rb-fsevent'
|
14
|
+
gem 'growl'
|
15
|
+
end
|
11
16
|
end
|
12
17
|
|
18
|
+
gem 'spree', '~> 1.1.3'
|
19
|
+
|
13
20
|
gemspec
|
data/Versionfile
CHANGED
@@ -1,11 +1,3 @@
|
|
1
|
-
# This file is used to designate compatibilty with different versions of Spree
|
2
|
-
# Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
|
3
|
-
|
4
|
-
# Examples
|
5
|
-
#
|
6
|
-
# "0.70.x" => { :branch => "master"}
|
7
|
-
# "0.60.x" => { :branch => "0-60-stable" }
|
8
|
-
# "0.40.x" => { :tag => "v1.0.0", :version => "1.0.0" }
|
9
|
-
|
10
1
|
"1.0.x" => { :ref => '2c31ead09bf6a62e7a0700a5d831c7933d63edd5' }
|
11
2
|
"1.1.x" => { :branch => "master"}
|
3
|
+
"1.2.x" => { :branch => "master"}
|
data/app/models/spree/slide.rb
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
<thead>
|
16
16
|
<tr data-hook="admin_slides_index_headers">
|
17
17
|
<th>Name</th>
|
18
|
+
<th data-hook="admin_slides_index_header_position">Position</th>
|
18
19
|
<th data-hook="admin_slides_index_header_actions"></th>
|
19
20
|
</tr>
|
20
21
|
</thead>
|
@@ -22,6 +23,7 @@
|
|
22
23
|
<% @slides.each do |slide|%>
|
23
24
|
<tr id="<%= dom_id slide %>" data-hook="admin_slides_index_rows">
|
24
25
|
<td width="350px" ><%=link_to slide.name, object_url(slide) %></td>
|
26
|
+
<td data-hook="admin_slides_index_position"><%= slide.position %></td>
|
25
27
|
<td data-hook="admin_slides_index_row_actions">
|
26
28
|
<%= link_to_edit slide, :class => 'edit' %>
|
27
29
|
<%= link_to_delete slide %>
|
data/config/locales/en.yml
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
module SpreeSlider
|
2
|
+
class InstallSimpleCarouselGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path("../templates", __FILE__)
|
4
|
+
def install
|
5
|
+
#copy slider partial
|
6
|
+
copy_file "simple_carousel_slider.html.erb", "app/views/spree/shared/_slider.html.erb"
|
7
|
+
|
8
|
+
#add javascripts
|
9
|
+
append_file "app/assets/javascripts/store/all.js", "//= require simple.carousel\n"
|
10
|
+
append_file "app/assets/javascripts/store/all.js", "//= require simple.carousel.slider\n"
|
11
|
+
|
12
|
+
|
13
|
+
#copy migrations
|
14
|
+
run 'bundle exec rake railties:install:migrations FROM=spree_slider'
|
15
|
+
|
16
|
+
#run migrations
|
17
|
+
res = ask "Would you like to run the migrations now? [Y/n]"
|
18
|
+
if res == "" || res.downcase == "y"
|
19
|
+
run 'bundle exec rake db:migrate'
|
20
|
+
else
|
21
|
+
puts "Skiping rake db:migrate, don't forget to run it!"
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
<div class="slider-wrapper">
|
17
17
|
<ul id="slider">
|
18
|
-
<% Spree::Slide.published.each do |s| %>
|
18
|
+
<% Spree::Slide.published.order('position ASC').each do |s| %>
|
19
19
|
<li><%= link_to image_tag(s.image.url, :title => '#' + s.name.to_url), s.link_url %></li>
|
20
20
|
<% end %>
|
21
21
|
</ul>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<div class="slider-wrapper theme-default">
|
14
14
|
<div class="ribbon"></div>
|
15
15
|
<div id="slider" class="nivoSlider">
|
16
|
-
<% Spree::Slide.published.each do |s| %>
|
16
|
+
<% Spree::Slide.published.order('position ASC').each do |s| %>
|
17
17
|
<% if s.body != "" %>
|
18
18
|
<%= link_to image_tag(s.image.url, :title => '#' + s.name.to_url), s.link_url %>
|
19
19
|
<% else %>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<% end %>
|
23
23
|
</div>
|
24
24
|
|
25
|
-
<% Spree::Slide.published.each do |s| %>
|
25
|
+
<% Spree::Slide.published.order('position ASC').each do |s| %>
|
26
26
|
<div id='<%= s.name.to_url %>' class='nivo-html-caption'>
|
27
27
|
<%= s.body.html_safe %>
|
28
28
|
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if Spree::Slide.published.count > 0 %>
|
2
|
+
<section id="slideshow">
|
3
|
+
<ul class="slider regular">
|
4
|
+
<% Spree::Slide.published.order('position ASC').each do |s| %>
|
5
|
+
<li>
|
6
|
+
<h1><%= s.name %></h1>
|
7
|
+
<%= link_to image_tag(s.image.url, :title => s.name.to_url), s.link_url %>
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
|
12
|
+
<a title="<%= t(:previous) %>" class="slider-prev"><%= t(:previous)%></a>
|
13
|
+
<a title="<%= t(:next) %>" class="slider-next"><%= t(:next) %></a>
|
14
|
+
</section>
|
15
|
+
<% end %>
|
data/lib/spree_slider/engine.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module SpreeSlider
|
2
2
|
class Engine < Rails::Engine
|
3
|
+
require 'spree/core'
|
4
|
+
isolate_namespace Spree
|
3
5
|
engine_name 'spree_slider'
|
4
6
|
|
5
7
|
config.autoload_paths += %W(#{config.root}/lib)
|
@@ -10,9 +12,6 @@ module SpreeSlider
|
|
10
12
|
end
|
11
13
|
|
12
14
|
def self.activate
|
13
|
-
Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
|
14
|
-
Rails.application.config.cache_classes ? require(c) : load(c)
|
15
|
-
end
|
16
15
|
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
|
17
16
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
18
17
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,32 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
-
|
1
|
+
ENV["RAILS_ENV"] ||= 'test'
|
2
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
6
3
|
require 'rspec/rails'
|
7
4
|
|
8
|
-
# Requires supporting
|
9
|
-
# in
|
10
|
-
Dir[File.
|
5
|
+
# Requires supporting files with custom matchers and macros, etc,
|
6
|
+
# in ./support/ and its subdirectories.
|
7
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
11
8
|
|
12
|
-
# Requires factories defined in spree_core
|
13
9
|
require 'spree/core/testing_support/factories'
|
10
|
+
require 'spree/core/testing_support/env'
|
11
|
+
require 'spree/core/testing_support/controller_requests'
|
12
|
+
require 'spree/core/url_helpers'
|
14
13
|
|
15
14
|
RSpec.configure do |config|
|
16
|
-
# == Mock Framework
|
17
|
-
#
|
18
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
19
|
-
#
|
20
|
-
# config.mock_with :mocha
|
21
|
-
# config.mock_with :flexmock
|
22
|
-
# config.mock_with :rr
|
23
15
|
config.mock_with :rspec
|
24
|
-
|
25
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
26
16
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
27
|
-
|
28
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
29
|
-
# examples within a transaction, remove the following line or assign false
|
30
|
-
# instead of true.
|
31
17
|
config.use_transactional_fixtures = true
|
32
|
-
|
18
|
+
|
19
|
+
config.include Spree::Core::TestingSupport::ControllerRequests
|
20
|
+
config.include Devise::TestHelpers, :type => :controller
|
21
|
+
end
|
data/spree_slider.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_slider'
|
5
|
-
s.version = '1.
|
5
|
+
s.version = '1.2.0'
|
6
6
|
s.summary = 'Spree Slider extension'
|
7
7
|
s.description = 'Adds a slider to the homepage'
|
8
8
|
s.required_ruby_version = '>= 1.8.7'
|
@@ -16,11 +16,5 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_path = 'lib'
|
17
17
|
s.requirements << 'none'
|
18
18
|
|
19
|
-
s.add_dependency 'spree_core', '
|
20
|
-
|
21
|
-
# s.add_development_dependency 'capybara', '1.0.1'
|
22
|
-
# s.add_development_dependency 'factory_girl'
|
23
|
-
s.add_development_dependency 'ffaker'
|
24
|
-
# s.add_development_dependency 'rspec-rails', '~> 2.7'
|
25
|
-
s.add_development_dependency 'sqlite3'
|
19
|
+
s.add_dependency 'spree_core', '>= 1.1.0'
|
26
20
|
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/**
|
2
|
+
* Simple Carousel
|
3
|
+
* Copyright (c) 2010 Tobias Zeising, http://www.aditu.de
|
4
|
+
* Licensed under the MIT license
|
5
|
+
*
|
6
|
+
* http://code.google.com/p/simple-carousel/
|
7
|
+
* Version 0.3
|
8
|
+
*/
|
9
|
+
(function($){
|
10
|
+
$.fn.simplecarousel = function( params ) {
|
11
|
+
// set config
|
12
|
+
var defaults = {
|
13
|
+
width: 700,
|
14
|
+
height: 500,
|
15
|
+
next: false,
|
16
|
+
prev: false,
|
17
|
+
vertical: false,
|
18
|
+
auto: false,
|
19
|
+
fade: false,
|
20
|
+
current: 0,
|
21
|
+
items: 0,
|
22
|
+
slidespeed: 600,
|
23
|
+
visible: 1,
|
24
|
+
pagination: false
|
25
|
+
};
|
26
|
+
var config = $.extend(defaults, params);
|
27
|
+
|
28
|
+
// configure carousel ul and li
|
29
|
+
var ul = $(this);
|
30
|
+
var li = ul.children('li');
|
31
|
+
|
32
|
+
config.items = li.length;
|
33
|
+
|
34
|
+
var height = config.height;
|
35
|
+
var width = config.width;
|
36
|
+
if(config.visible>1) {
|
37
|
+
if(config.vertical)
|
38
|
+
height = height*config.visible;
|
39
|
+
else
|
40
|
+
width = width*config.visible;
|
41
|
+
}
|
42
|
+
|
43
|
+
ul.wrap('<div class="carousel-frame" style="width:'+width+'px;height:'+height+'px;overflow:hidden">');
|
44
|
+
var container = ul.parent('.carousel-frame');
|
45
|
+
if(!config.vertical) {
|
46
|
+
ul.width(config.items*config.width);
|
47
|
+
ul.height(config.height);
|
48
|
+
} else {
|
49
|
+
ul.width(config.width);
|
50
|
+
ul.height(config.items*config.height);
|
51
|
+
}
|
52
|
+
ul.css('overflow','hidden');
|
53
|
+
|
54
|
+
li.each(function(i,item) {
|
55
|
+
$(item).width(config.width);
|
56
|
+
$(item).height(config.height);
|
57
|
+
if(!config.vertical)
|
58
|
+
$(item).css('float','left');
|
59
|
+
});
|
60
|
+
|
61
|
+
// function for sliding the carousel
|
62
|
+
var slide = function(dir, click) {
|
63
|
+
if(typeof click == "undefined" & config.auto==false)
|
64
|
+
return;
|
65
|
+
|
66
|
+
if(dir=="next") {
|
67
|
+
config.current += config.visible;
|
68
|
+
if(config.current>=config.items)
|
69
|
+
config.current = 0;
|
70
|
+
} else if(dir=="prev") {
|
71
|
+
config.current -= config.visible;
|
72
|
+
if(config.current<0)
|
73
|
+
config.current = (config.visible==1) ? config.items-1 : config.items-config.visible+(config.visible-(config.items%config.visible));
|
74
|
+
} else {
|
75
|
+
config.current = dir;
|
76
|
+
}
|
77
|
+
|
78
|
+
// set pagination
|
79
|
+
if(config.pagination != false) {
|
80
|
+
container.next('.carousel-pagination').find('li').removeClass('carousel-pagination-active')
|
81
|
+
container.next('.carousel-pagination').find('li:nth-child('+(config.current+1)+')').addClass('carousel-pagination-active');
|
82
|
+
}
|
83
|
+
|
84
|
+
// fade
|
85
|
+
if(config.fade!=false) {
|
86
|
+
ul.fadeOut(config.fade, function() {
|
87
|
+
ul.css({marginLeft: -1.0*config.current*config.width});
|
88
|
+
ul.fadeIn(config.fade);
|
89
|
+
});
|
90
|
+
|
91
|
+
// slide
|
92
|
+
} else {
|
93
|
+
if(!config.vertical)
|
94
|
+
ul.animate( {marginLeft: -1.0*config.current*config.width}, config.slidespeed );
|
95
|
+
else
|
96
|
+
ul.animate( {marginTop: -1.0*config.current*config.height}, config.slidespeed );
|
97
|
+
}
|
98
|
+
|
99
|
+
if(typeof click != "undefined")
|
100
|
+
config.auto = false;
|
101
|
+
|
102
|
+
if(config.auto!=false)
|
103
|
+
setTimeout(function() {
|
104
|
+
slide('next');
|
105
|
+
}, config.auto);
|
106
|
+
}
|
107
|
+
|
108
|
+
// include pagination
|
109
|
+
if(config.pagination != false) {
|
110
|
+
container.after('<ul class="carousel-pagination"></ul>');
|
111
|
+
var pagination = container.next('.carousel-pagination');
|
112
|
+
for(var i=0;i<config.items;i++) {
|
113
|
+
if(i==0)
|
114
|
+
pagination.append('<li class="carousel-pagination-active"></li>');
|
115
|
+
else
|
116
|
+
pagination.append('<li></li>');
|
117
|
+
}
|
118
|
+
|
119
|
+
pagination.find('li').each(function(index, item) {
|
120
|
+
$(this).click(function() {
|
121
|
+
slide(index,true);
|
122
|
+
});
|
123
|
+
});
|
124
|
+
}
|
125
|
+
|
126
|
+
// set event handler for next and prev
|
127
|
+
if(config.next!=false)
|
128
|
+
config.next.click(function() {
|
129
|
+
slide('next',true);
|
130
|
+
});
|
131
|
+
|
132
|
+
|
133
|
+
if(config.prev!=false)
|
134
|
+
config.prev.click(function() {
|
135
|
+
slide('prev',true);
|
136
|
+
});
|
137
|
+
|
138
|
+
// start auto sliding
|
139
|
+
if(config.auto!=false)
|
140
|
+
setTimeout(function() {
|
141
|
+
slide('next');
|
142
|
+
}, config.auto);
|
143
|
+
}
|
144
|
+
})(jQuery);
|