spree_multi_slideshow 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/README.md +14 -12
  2. data/app/assets/images/store/bx_loader.gif +0 -0
  3. data/app/assets/images/store/controls.png +0 -0
  4. data/app/assets/javascripts/admin/slide_settings.js.erb +41 -0
  5. data/app/assets/javascripts/admin/slides/index.js.coffee +15 -0
  6. data/app/assets/javascripts/admin/slides/new.js.coffee +7 -0
  7. data/app/assets/javascripts/admin/spree_multi_slideshow.js +3 -1
  8. data/app/assets/javascripts/store/spree_multi_slideshow.js +1284 -1
  9. data/app/assets/stylesheets/store/spree_multi_slideshow.css +197 -3
  10. data/app/controllers/spree/admin/slide_settings_controller.rb +50 -0
  11. data/app/controllers/spree/admin/slides_controller.rb +15 -14
  12. data/app/controllers/spree/admin/slideshows_controller.rb +31 -0
  13. data/app/helpers/spree/slideshows_helper.rb +68 -0
  14. data/app/models/spree/app_configuration_decorator.rb +25 -0
  15. data/app/models/spree/product_decorator.rb +3 -0
  16. data/app/models/spree/slide.rb +23 -25
  17. data/app/models/spree/slideshow.rb +17 -0
  18. data/app/models/spree/taxon_decorator.rb +3 -0
  19. data/app/overrides/slideshow_admin_tab.rb +10 -0
  20. data/app/views/spree/admin/shared/_slideshow_sub_menu.html.erb +6 -0
  21. data/app/views/spree/admin/shared/_slideshow_tabs.html.erb +21 -0
  22. data/app/views/spree/admin/slide_settings/edit.html.erb +74 -0
  23. data/app/views/spree/admin/slides/_form.html.erb +29 -9
  24. data/app/views/spree/admin/slides/edit.html.erb +26 -16
  25. data/app/views/spree/admin/slides/index.html.erb +47 -31
  26. data/app/views/spree/admin/slides/new.html.erb +12 -9
  27. data/app/views/spree/admin/slideshows/_form.html.erb +59 -0
  28. data/app/views/spree/admin/slideshows/edit.html.erb +17 -0
  29. data/app/views/spree/admin/slideshows/index.html.erb +51 -0
  30. data/app/views/spree/admin/slideshows/new.html.erb +80 -0
  31. data/app/views/spree/admin/slideshows/new.js.erb +2 -0
  32. data/config/locales/en.yml +53 -85
  33. data/config/locales/it.yml +56 -90
  34. data/config/routes.rb +3 -1
  35. data/db/migrate/20120116081431_create_slideshows.rb +17 -0
  36. data/db/migrate/20120116083546_create_slides.rb +5 -4
  37. data/db/migrate/20120323164044_multi_slideshow_namespace.rb +1 -1
  38. data/lib/generators/spree_multi_slideshow/install/install_generator.rb +1 -21
  39. data/lib/spree_multi_slideshow.rb +0 -2
  40. metadata +26 -73
  41. data/app/assets/images/store/slides/bg-gallery.png +0 -0
  42. data/app/assets/images/store/slides/bg-text02.png +0 -0
  43. data/app/assets/images/store/slides/sprite01.png +0 -0
  44. data/app/assets/javascripts/admin/slides/index.js +0 -10
  45. data/app/assets/javascripts/admin/slides/new.js +0 -5
  46. data/app/assets/javascripts/store/fadeGallery.js +0 -229
  47. data/app/assets/stylesheets/admin/spree_multi_slideshow.css +0 -16
  48. data/app/assets/stylesheets/store/carousel_slideshow.css.scss +0 -73
  49. data/app/controllers/spree/admin/slideshow_types_controller.rb +0 -11
  50. data/app/controllers/spree/slides_controller.rb +0 -5
  51. data/app/controllers/spree/slideshow_types_controller.rb +0 -5
  52. data/app/helpers/spree/slides_helper.rb +0 -4
  53. data/app/helpers/spree/slideshow_types_helper.rb +0 -53
  54. data/app/models/spree/slideshow_type.rb +0 -18
  55. data/app/overrides/slideshow_type_admin_tab.rb +0 -4
  56. data/app/views/spree/admin/shared/_slideshow_type_tabs.html.erb +0 -16
  57. data/app/views/spree/admin/slideshow_types/_form.html.erb +0 -8
  58. data/app/views/spree/admin/slideshow_types/edit.html.erb +0 -8
  59. data/app/views/spree/admin/slideshow_types/index.html.erb +0 -32
  60. data/app/views/spree/admin/slideshow_types/new.html.erb +0 -7
  61. data/db/migrate/20120116081431_create_slideshow_types.rb +0 -15
@@ -2,23 +2,13 @@ module SpreeMultiSlideshow
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
 
5
- def add_formtastic
6
- res = ask "Would you like to run the formtastic install now? [Y/n]"
7
- if res == "" || res.downcase == "y"
8
- run 'rails generate formtastic:install'
9
- else
10
- puts "Skiping rails generate formtastic:install, don't forget to run it!"
11
- end
12
- end
13
-
14
5
  def add_javascripts
15
6
  append_file "app/assets/javascripts/store/all.js", "//= require store/spree_multi_slideshow\n"
16
- #append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_multi_slideshow\n"
7
+ append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_multi_slideshow\n"
17
8
  end
18
9
 
19
10
  def add_stylesheets
20
11
  inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_multi_slideshow\n", :before => /\*\//, :verbose => true
21
- inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_multi_slideshow\n", :before => /\*\//, :verbose => true
22
12
  end
23
13
 
24
14
  def add_migrations
@@ -33,16 +23,6 @@ module SpreeMultiSlideshow
33
23
  puts "Skiping rake db:migrate, don't forget to run it!"
34
24
  end
35
25
  end
36
-
37
- def add_ckeditor
38
- res = ask "Would you like to run the ckeditor generator now? [Y/n]"
39
- if res == "" || res.downcase == "y"
40
- run 'rails generate ckeditor:install --orm=active_record --backend=paperclip'
41
- else
42
- puts "Skiping rails generate ckeditor:install --orm=active_record --backend=paperclip, don't forget to run it!"
43
- end
44
- end
45
-
46
26
  end
47
27
  end
48
28
  end
@@ -1,4 +1,2 @@
1
1
  require 'spree_core'
2
- require 'ckeditor'
3
- require 'formtastic'
4
2
  require 'spree_multi_slideshow/engine'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_multi_slideshow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-26 00:00:00.000000000 Z
12
+ date: 2013-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 1.3.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: aws-sdk
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: formtastic
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: paperclip
64
48
  requirement: !ruby/object:Gem::Requirement
@@ -75,38 +59,6 @@ dependencies:
75
59
  - - ! '>='
76
60
  - !ruby/object:Gem::Version
77
61
  version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: ckeditor
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :runtime
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: rspec-rails
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
62
  description:
111
63
  email: damiano.giacomello@diginess.it
112
64
  executables: []
@@ -118,36 +70,37 @@ files:
118
70
  - lib/generators/spree_multi_slideshow/install/install_generator.rb
119
71
  - lib/spree_multi_slideshow/engine.rb
120
72
  - lib/spree_multi_slideshow.rb
121
- - app/assets/images/store/slides/bg-gallery.png
122
- - app/assets/images/store/slides/bg-text02.png
123
- - app/assets/images/store/slides/sprite01.png
124
- - app/assets/javascripts/admin/slides/index.js
125
- - app/assets/javascripts/admin/slides/new.js
73
+ - app/assets/images/store/bx_loader.gif
74
+ - app/assets/images/store/controls.png
75
+ - app/assets/javascripts/admin/slide_settings.js.erb
76
+ - app/assets/javascripts/admin/slides/index.js.coffee
77
+ - app/assets/javascripts/admin/slides/new.js.coffee
126
78
  - app/assets/javascripts/admin/spree_multi_slideshow.js
127
- - app/assets/javascripts/store/fadeGallery.js
128
79
  - app/assets/javascripts/store/spree_multi_slideshow.js
129
- - app/assets/stylesheets/admin/spree_multi_slideshow.css
130
- - app/assets/stylesheets/store/carousel_slideshow.css.scss
131
80
  - app/assets/stylesheets/store/spree_multi_slideshow.css
81
+ - app/controllers/spree/admin/slide_settings_controller.rb
132
82
  - app/controllers/spree/admin/slides_controller.rb
133
- - app/controllers/spree/admin/slideshow_types_controller.rb
134
- - app/controllers/spree/slides_controller.rb
135
- - app/controllers/spree/slideshow_types_controller.rb
136
- - app/helpers/spree/slides_helper.rb
137
- - app/helpers/spree/slideshow_types_helper.rb
83
+ - app/controllers/spree/admin/slideshows_controller.rb
84
+ - app/helpers/spree/slideshows_helper.rb
85
+ - app/models/spree/app_configuration_decorator.rb
86
+ - app/models/spree/product_decorator.rb
138
87
  - app/models/spree/slide.rb
139
- - app/models/spree/slideshow_type.rb
140
- - app/overrides/slideshow_type_admin_tab.rb
141
- - app/views/spree/admin/shared/_slideshow_type_tabs.html.erb
88
+ - app/models/spree/slideshow.rb
89
+ - app/models/spree/taxon_decorator.rb
90
+ - app/overrides/slideshow_admin_tab.rb
91
+ - app/views/spree/admin/shared/_slideshow_sub_menu.html.erb
92
+ - app/views/spree/admin/shared/_slideshow_tabs.html.erb
93
+ - app/views/spree/admin/slide_settings/edit.html.erb
142
94
  - app/views/spree/admin/slides/_form.html.erb
143
95
  - app/views/spree/admin/slides/edit.html.erb
144
96
  - app/views/spree/admin/slides/index.html.erb
145
97
  - app/views/spree/admin/slides/new.html.erb
146
- - app/views/spree/admin/slideshow_types/_form.html.erb
147
- - app/views/spree/admin/slideshow_types/edit.html.erb
148
- - app/views/spree/admin/slideshow_types/index.html.erb
149
- - app/views/spree/admin/slideshow_types/new.html.erb
150
- - db/migrate/20120116081431_create_slideshow_types.rb
98
+ - app/views/spree/admin/slideshows/_form.html.erb
99
+ - app/views/spree/admin/slideshows/edit.html.erb
100
+ - app/views/spree/admin/slideshows/index.html.erb
101
+ - app/views/spree/admin/slideshows/new.html.erb
102
+ - app/views/spree/admin/slideshows/new.js.erb
103
+ - db/migrate/20120116081431_create_slideshows.rb
151
104
  - db/migrate/20120116083546_create_slides.rb
152
105
  - db/migrate/20120323164044_multi_slideshow_namespace.rb
153
106
  - config/locales/en.yml
@@ -1,10 +0,0 @@
1
- $(document).ready(function(){
2
-
3
- $('#new_slide_link').click(function (event) {
4
- event.preventDefault();
5
- $(this).hide();
6
- $.ajax({type: 'GET', url: this.href, data: ({authenticity_token: AUTH_TOKEN}),
7
- success: function(r){ $('#slides').html(r);} });
8
- });
9
-
10
- });
@@ -1,5 +0,0 @@
1
- $('#cancel_link').click(function (event) {
2
- event.preventDefault();
3
- $('#new_slide_link').show();
4
- $('#slides').html('');
5
- });
@@ -1,229 +0,0 @@
1
- // page init
2
- jQuery(function($) {
3
- initGalleries();
4
- });
5
-
6
- // galleries init
7
- function initGalleries(){
8
- // main banner slideshow
9
- jQuery('div.gallery').fadeGallery({
10
- autoRotation: true,
11
- switchTime: 5000, //ms
12
- duration: 800 //ms
13
- });
14
- };
15
-
16
- // slideshow plugin
17
- jQuery.fn.fadeGallery = function(_options){
18
- var _options = jQuery.extend({
19
- slideElements:'div.gallery-inner > ul > li',
20
- pagerGener: false,
21
- pagerHold: false,
22
- pagerLinks:'ul.nav-list li',
23
- btnNext:'a.gallery-control.right',
24
- btnPrev:'a.gallery-control.left',
25
- btnPlayPause:'a.play-pause',
26
- btnPlay:'a.play',
27
- btnPause:'a.pause',
28
- pausedClass:'paused',
29
- disabledClass: 'disabled',
30
- playClass:'playing',
31
- activeClass:'active',
32
- currentNum:false,
33
- allNum:false,
34
- startSlide:null,
35
- noCircle:false,
36
- caption:'ul.caption > li',
37
- pauseOnHover:false,
38
- autoRotation:false,
39
- autoHeight:false,
40
- onChange:false,
41
- switchTime:3000,
42
- duration:650,
43
- event:'click'
44
- },_options);
45
-
46
- return this.each(function(){
47
- // gallery options
48
- var _this = jQuery(this);
49
- var _slides = jQuery(_options.slideElements, _this);
50
- var _btnPrev = jQuery(_options.btnPrev, _this);
51
- var _btnNext = jQuery(_options.btnNext, _this);
52
- var _btnPlayPause = jQuery(_options.btnPlayPause, _this);
53
- var _btnPause = jQuery(_options.btnPause, _this);
54
- var _btnPlay = jQuery(_options.btnPlay, _this);
55
- var _pauseOnHover = _options.pauseOnHover;
56
- var _autoRotation = _options.autoRotation;
57
- var _activeClass = _options.activeClass;
58
- var _disabledClass = _options.disabledClass;
59
- var _pausedClass = _options.pausedClass;
60
- var _playClass = _options.playClass;
61
- var _autoHeight = _options.autoHeight;
62
- var _duration = _options.duration;
63
- var _switchTime = _options.switchTime;
64
- var _controlEvent = _options.event;
65
- var _currentNum = (_options.currentNum ? jQuery(_options.currentNum, _this) : false);
66
- var _allNum = (_options.allNum ? jQuery(_options.allNum, _this) : false);
67
- var _startSlide = _options.startSlide;
68
- var _noCycle = _options.noCircle;
69
- var _onChange = _options.onChange;
70
- var _pagerGener = _options.pagerGener;
71
- var _pagerHold = jQuery(_options.pagerHold,_this);
72
- var _caption = jQuery(_options.caption,_this);
73
- var _paging = '';
74
- if(_pagerGener){
75
- for(var i=0; i< _slides.length; i++){
76
- _paging += '<li><a href="#">'+(i+1)+'</a></li>';
77
- }
78
- _pagerHold.html('<ul>'+_paging+'</ul>');
79
- }
80
- var _pagerLinks = jQuery(_options.pagerLinks, _this);
81
- // gallery init
82
- var _hover = false;
83
- var _prevIndex = 0;
84
- var _currentIndex = 0;
85
- var _slideCount = _slides.length;
86
- var _timer;
87
- if(_slideCount < 2) return;
88
-
89
- _prevIndex = _slides.index(_slides.filter('.'+_activeClass));
90
- if(_prevIndex < 0) _prevIndex = _currentIndex = 0;
91
- else _currentIndex = _prevIndex;
92
- if(_startSlide != null) {
93
- if(_startSlide == 'random') _prevIndex = _currentIndex = Math.floor(Math.random()*_slideCount);
94
- else _prevIndex = _currentIndex = parseInt(_startSlide);
95
- }
96
- _slides.hide().eq(_currentIndex).show();
97
- _caption.hide().eq(_currentIndex).show();
98
- if(_autoRotation) _this.removeClass(_pausedClass).addClass(_playClass);
99
- else _this.removeClass(_playClass).addClass(_pausedClass);
100
-
101
- // gallery control
102
- if(_btnPrev.length) {
103
- _btnPrev.bind(_controlEvent,function(){
104
- prevSlide();
105
- return false;
106
- });
107
- }
108
- if(_btnNext.length) {
109
- _btnNext.bind(_controlEvent,function(){
110
- nextSlide();
111
- return false;
112
- });
113
- }
114
- if(_pagerLinks.length) {
115
- _pagerLinks.each(function(_ind){
116
- jQuery(this).bind(_controlEvent,function(){
117
- if(_currentIndex != _ind) {
118
- _prevIndex = _currentIndex;
119
- _currentIndex = _ind;
120
- switchSlide();
121
- }
122
- return false;
123
- });
124
- });
125
- }
126
-
127
- // play pause section
128
- if(_btnPlayPause.length) {
129
- _btnPlayPause.bind(_controlEvent,function(){
130
- if(_this.hasClass(_pausedClass)) {
131
- _this.removeClass(_pausedClass).addClass(_playClass);
132
- _autoRotation = true;
133
- autoSlide();
134
- } else {
135
- _autoRotation = false;
136
- if(_timer) clearTimeout(_timer);
137
- _this.removeClass(_playClass).addClass(_pausedClass);
138
- }
139
- return false;
140
- });
141
- }
142
- if(_btnPlay.length) {
143
- _btnPlay.bind(_controlEvent,function(){
144
- _this.removeClass(_pausedClass).addClass(_playClass);
145
- _autoRotation = true;
146
- autoSlide();
147
- return false;
148
- });
149
- }
150
- if(_btnPause.length) {
151
- _btnPause.bind(_controlEvent,function(){
152
- _autoRotation = false;
153
- if(_timer) clearTimeout(_timer);
154
- _this.removeClass(_playClass).addClass(_pausedClass);
155
- return false;
156
- });
157
- }
158
- // gallery animation
159
- function prevSlide() {
160
- _prevIndex = _currentIndex;
161
- if(_currentIndex > 0) _currentIndex--;
162
- else {
163
- if(_noCycle) return;
164
- else _currentIndex = _slideCount-1;
165
- }
166
- switchSlide();
167
- }
168
- function nextSlide() {
169
- _prevIndex = _currentIndex;
170
- if(_currentIndex < _slideCount-1) _currentIndex++;
171
- else {
172
- if(_noCycle) return;
173
- else _currentIndex = 0;
174
- }
175
- switchSlide();
176
- }
177
- function refreshStatus() {
178
- if(_pagerLinks.length) _pagerLinks.removeClass(_activeClass).eq(_currentIndex).addClass(_activeClass);
179
- if(_currentNum) _currentNum.text(_currentIndex+1);
180
- if(_allNum) _allNum.text(_slideCount);
181
- _slides.eq(_prevIndex).removeClass(_activeClass);
182
- _slides.eq(_currentIndex).addClass(_activeClass);
183
- if(_noCycle) {
184
- if(_btnPrev.length) {
185
- if(_currentIndex == 0) _btnPrev.addClass(_disabledClass);
186
- else _btnPrev.removeClass(_disabledClass);
187
- }
188
- if(_btnNext.length) {
189
- if(_currentIndex == _slideCount-1) _btnNext.addClass(_disabledClass);
190
- else _btnNext.removeClass(_disabledClass);
191
- }
192
- }
193
- if(typeof _onChange === 'function') {
194
- _onChange(_this, _currentIndex);
195
- }
196
- }
197
- function switchSlide() {
198
- _slides.eq(_prevIndex).stop().animate({opacity:0},{duration: _duration, queue: false,complete:function(){
199
- jQuery(this).css({display:'none'});
200
- }})
201
- _slides.eq(_currentIndex).stop().css({display:'block',opacity:0}).animate({opacity:1},{duration: _duration, queue: false,complete:function(){
202
- jQuery(this).css({opacity:''});
203
- }})
204
- _caption.eq(_prevIndex).fadeOut();
205
- _caption.eq(_currentIndex).fadeIn();
206
- if(_autoHeight) _slides.eq(_currentIndex).parent().animate({height:_slides.eq(_currentIndex).outerHeight(true)},{duration:_duration,queue:false});
207
- refreshStatus();
208
- autoSlide();
209
- }
210
-
211
- // autoslide function
212
- function autoSlide() {
213
- if(!_autoRotation || _hover) return;
214
- if(_timer) clearTimeout(_timer);
215
- _timer = setTimeout(nextSlide,_switchTime+_duration);
216
- }
217
- if(_pauseOnHover) {
218
- _this.hover(function(){
219
- _hover = true;
220
- if(_timer) clearTimeout(_timer);
221
- },function(){
222
- _hover = false;
223
- autoSlide();
224
- });
225
- }
226
- refreshStatus();
227
- autoSlide();
228
- });
229
- };