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.
Files changed (80) hide show
  1. data/.gitignore +2 -1
  2. data/Gemfile +13 -6
  3. data/Versionfile +1 -9
  4. data/app/models/spree/slide.rb +1 -1
  5. data/app/overrides/spree/admin/configurations/index/add_slides_to_admin_configurations_menu.html.erb.deface +5 -0
  6. data/app/overrides/spree/admin/shared/_configuration_menu/add_slides_to_admin_configurations_sidebar_menu.html.erb.deface +2 -0
  7. data/app/overrides/spree/home/index/add_slider.html.erb.deface +4 -0
  8. data/app/overrides/spree/layouts/spree_application/add_slider.html.erb.deface +2 -0
  9. data/app/views/spree/admin/slides/_form.html.erb +4 -1
  10. data/app/views/spree/admin/slides/index.html.erb +2 -0
  11. data/app/views/spree/admin/slides/show.html.erb +6 -0
  12. data/config/locales/de.yml +3 -0
  13. data/config/locales/en.yml +2 -4
  14. data/config/locales/es.yml +3 -0
  15. data/config/locales/nl-NL.yml +3 -0
  16. data/config/locales/nl.yml +3 -0
  17. data/db/migrate/20120816192758_add_position_to_slides.rb +5 -0
  18. data/lib/generators/spree_slider/install_simple_carousel_generator.rb +30 -0
  19. data/lib/generators/spree_slider/templates/anything_slider.html.erb +1 -1
  20. data/lib/generators/spree_slider/templates/nivo_slider.html.erb +2 -2
  21. data/lib/generators/spree_slider/templates/simple_carousel_slider.html.erb +15 -0
  22. data/lib/spree_slider/engine.rb +2 -3
  23. data/spec/spec_helper.rb +12 -23
  24. data/spree_slider.gemspec +2 -8
  25. data/vendor/assets/simple-carousel/readme.txt +6 -0
  26. data/vendor/assets/simple-carousel/simple.carousel.js +144 -0
  27. data/vendor/assets/simple-carousel/simple.carousel.slider.js +14 -0
  28. metadata +18 -88
  29. data/Gemfile.lock +0 -175
  30. data/app/overrides/add_slider_to_layout.rb +0 -8
  31. data/app/overrides/add_slides_to_admin_configurations_menu.rb +0 -9
  32. data/app/overrides/add_slides_to_admin_configurations_sidebar_menu.rb +0 -7
  33. data/app/views/spree/home/index.html.erb +0 -14
  34. data/vendor/assets/anything-slider/demos.html +0 -740
  35. data/vendor/assets/anything-slider/demos/colorbox/border.png +0 -0
  36. data/vendor/assets/anything-slider/demos/colorbox/colorbox.css +0 -62
  37. data/vendor/assets/anything-slider/demos/colorbox/controls.png +0 -0
  38. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomCenter.png +0 -0
  39. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomLeft.png +0 -0
  40. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomRight.png +0 -0
  41. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleLeft.png +0 -0
  42. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleRight.png +0 -0
  43. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopCenter.png +0 -0
  44. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopLeft.png +0 -0
  45. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopRight.png +0 -0
  46. data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox-min.js +0 -4
  47. data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox.js +0 -769
  48. data/vendor/assets/anything-slider/demos/colorbox/loading.gif +0 -0
  49. data/vendor/assets/anything-slider/demos/colorbox/loading_background.png +0 -0
  50. data/vendor/assets/anything-slider/demos/colorbox/overlay.png +0 -0
  51. data/vendor/assets/anything-slider/demos/css/page.css +0 -148
  52. data/vendor/assets/anything-slider/demos/images/251356.jpg +0 -0
  53. data/vendor/assets/anything-slider/demos/images/apple-touch-icon.png +0 -0
  54. data/vendor/assets/anything-slider/demos/images/favicon.ico +0 -0
  55. data/vendor/assets/anything-slider/demos/images/slide-civil-1.jpg +0 -0
  56. data/vendor/assets/anything-slider/demos/images/slide-civil-2.jpg +0 -0
  57. data/vendor/assets/anything-slider/demos/images/slide-env-1.jpg +0 -0
  58. data/vendor/assets/anything-slider/demos/images/slide-env-2.jpg +0 -0
  59. data/vendor/assets/anything-slider/demos/images/slide-tele-1.jpg +0 -0
  60. data/vendor/assets/anything-slider/demos/images/slide-tele-2.jpg +0 -0
  61. data/vendor/assets/anything-slider/demos/images/th-slide-civil-1.jpg +0 -0
  62. data/vendor/assets/anything-slider/demos/images/th-slide-civil-2.jpg +0 -0
  63. data/vendor/assets/anything-slider/demos/images/th-slide-env-1.jpg +0 -0
  64. data/vendor/assets/anything-slider/demos/images/th-slide-env-2.jpg +0 -0
  65. data/vendor/assets/anything-slider/demos/js/demo.js +0 -132
  66. data/vendor/assets/anything-slider/demos/video/movie.mp4 +0 -0
  67. data/vendor/assets/anything-slider/demos/video/movie.ogg +0 -0
  68. data/vendor/assets/anything-slider/demos/video/movie.webm +0 -0
  69. data/vendor/assets/anything-slider/expand.html +0 -97
  70. data/vendor/assets/anything-slider/index.html +0 -470
  71. data/vendor/assets/anything-slider/simple.html +0 -79
  72. data/vendor/assets/anything-slider/video.html +0 -341
  73. data/vendor/assets/nivo-slider/demo/demo.html +0 -39
  74. data/vendor/assets/nivo-slider/demo/images/dev7logo.png +0 -0
  75. data/vendor/assets/nivo-slider/demo/images/nemo.jpg +0 -0
  76. data/vendor/assets/nivo-slider/demo/images/toystory.jpg +0 -0
  77. data/vendor/assets/nivo-slider/demo/images/up.jpg +0 -0
  78. data/vendor/assets/nivo-slider/demo/images/walle.jpg +0 -0
  79. data/vendor/assets/nivo-slider/demo/scripts/jquery-1.6.1.min.js +0 -18
  80. data/vendor/assets/nivo-slider/demo/style.css +0 -100
data/.gitignore CHANGED
@@ -8,4 +8,5 @@ tmp
8
8
  nbproject
9
9
  *.swp
10
10
  spec/dummy
11
- pkg/*
11
+ pkg/*
12
+ Gemfile.lock
data/Gemfile CHANGED
@@ -1,13 +1,20 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  group :test do
4
- gem 'ffaker'
5
- end
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 RUBY_VERSION < "1.9"
8
- gem "ruby-debug"
9
- else
10
- gem "ruby-debug19"
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
@@ -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"}
@@ -1,5 +1,5 @@
1
1
  class Spree::Slide < ActiveRecord::Base
2
2
  has_attached_file :image
3
3
  scope :published, where(:published => true)
4
- attr_accessible :name, :body, :link_url, :published, :image
4
+ attr_accessible :name, :body, :link_url, :published, :image, :position
5
5
  end
@@ -0,0 +1,5 @@
1
+ <!-- insert_bottom "[data-hook='admin_configurations_menu']" -->
2
+ <tr>
3
+ <td><%= link_to 'Spree Slider', admin_slides_path %></td>
4
+ <td>Manage Spree Slider contents</td>
5
+ </tr>
@@ -0,0 +1,2 @@
1
+ <!-- insert_bottom "[data-hook='admin_configurations_sidebar_menu']" -->
2
+ <%= configurations_sidebar_menu_item 'Spree Slider', admin_slides_path %>
@@ -0,0 +1,4 @@
1
+ <!-- insert_before '[data-hook="homepage_products"]' -->
2
+ <% content_for :spree_slider do %>
3
+ <%= render 'spree/shared/slider' %>
4
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <!-- insert_after '#header[data-hook]' -->
2
+ <%= yield :spree_slider %>
@@ -18,4 +18,7 @@
18
18
  <%= f.label :is_published, t(:published) %><br />
19
19
  <%= f.check_box :published %>
20
20
  <% end %>
21
-
21
+ <%= f.field_container :position do %>
22
+ <%= f.label :position, t(:position) %>
23
+ <%= f.number_field :position %>
24
+ <% end %>
@@ -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' %> &nbsp;
27
29
  <%= link_to_delete slide %>
@@ -33,6 +33,12 @@
33
33
  <%= @slide.image_file_name %>
34
34
  </td>
35
35
  </tr>
36
+ <tr data-hook="position">
37
+ <th><%= t(:position) %></th>
38
+ <td>
39
+ <%= @slide.position %>
40
+ </td>
41
+ </tr>
36
42
  </table>
37
43
 
38
44
  <p>
@@ -0,0 +1,3 @@
1
+ de:
2
+ next: "Nächste"
3
+ previous: "Vorhergehend"
@@ -1,5 +1,3 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
1
  en:
5
- hello: "Hello world"
2
+ next: "Next"
3
+ previous: "Previous"
@@ -0,0 +1,3 @@
1
+ es:
2
+ next: "Próximo"
3
+ previous: "Previo"
@@ -0,0 +1,3 @@
1
+ nl-NL:
2
+ next: "Volgende"
3
+ previous: "Vorige"
@@ -0,0 +1,3 @@
1
+ nl:
2
+ next: "Volgende"
3
+ previous: "Vorige"
@@ -0,0 +1,5 @@
1
+ class AddPositionToSlides < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_slides, :position, :integer, :null => false, :default => 0
4
+ end
5
+ end
@@ -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 %>
@@ -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
@@ -1,32 +1,21 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
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 ruby files with custom matchers and macros, etc,
9
- # in spec/support/ and its subdirectories.
10
- Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
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
- end
18
+
19
+ config.include Spree::Core::TestingSupport::ControllerRequests
20
+ config.include Devise::TestHelpers, :type => :controller
21
+ end
@@ -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.1.0'
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', '~> 1.1.0'
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,6 @@
1
+ Simple Carousel
2
+ Copyright (c) 2010 Tobias Zeising, http://www.aditu.de
3
+ Licensed under the MIT license
4
+ Version 0.3
5
+
6
+ http://code.google.com/p/simple-carousel/
@@ -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);