spree_multi_slideshow 0.70.71 → 0.70.72

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,72 +2,206 @@
2
2
  *= require store/spree_core
3
3
  */
4
4
 
5
- .gallery{
6
- width: 900px;
7
- height:276px;
8
- padding:15px 0 0;
9
- overflow: hidden;
10
- z-index:0;
11
- color:#fff;
12
- background:url(/assets/images/bg-gallery.png) no-repeat 20px 0;
13
- margin-bottom:-2px;
14
- }
15
- .gallery .frame{
16
- width:900px;
17
- overflow:hidden;
18
- position:relative;
19
- height:251px;
20
- }
21
- .gallery .frame ul{
22
- position:absolute;
23
- overflow:hidden;
24
- margin:0;
25
- padding:0;
26
- list-style:none;
27
- width:900px;
28
- height:251px;
29
- }
30
- .gallery .frame li{
31
- width:900px;
32
- height:251px;
33
- position:absolute;
34
- top:0;
35
- left:0;
36
- background:#f1f1f1;
37
- }
38
- .gallery .frame li.active{z-index:2;}
39
- .gallery img{
40
- display:block;
41
- }
42
- .gallery .prev,
43
- .gallery .next{
44
- position:absolute;
45
- top:160px;
46
- left:47px;
47
- background:url(/assets/images/sprite01.png) no-repeat;
48
- width:39px;
49
- height:39px;
50
- text-indent:-9999px;
51
- overflow:hidden;
52
- z-index:3;
53
- }
54
- .gallery .next{
55
- right:56px;
56
- left:auto;
57
- background-position: 0 -43px;
58
- }
59
- .gallery .text-holder{
60
- background:url(/assets/images/bg-text02.png) no-repeat;
61
- width: 234px;
62
- height:98px;
63
- padding:45px 0 0 50px;
64
- position:absolute;
65
- right:1px;
66
- bottom:1px;
67
- font:bold 33px/40px 'Candrb', Arial, Helvetica, sans-serif;
68
- text-align:center;
69
- }
70
- .gallery .text-holder strong span{
71
- font-size:52px;
72
- display:block;
5
+ /**
6
+ * BxSlider v4.0 - Fully loaded, responsive content slider
7
+ * http://bxslider.com
8
+ *
9
+ * Written by: Steven Wanderski, 2012
10
+ * http://stevenwanderski.com
11
+ * (while drinking Belgian ales and listening to jazz)
12
+ *
13
+ * CEO and founder of bxCreative, LTD
14
+ * http://bxcreative.com
15
+ */
16
+
17
+
18
+ /** RESET AND LAYOUT
19
+ ===================================*/
20
+
21
+ .bx-wrapper {
22
+ position: relative;
23
+ margin: 0 0 60px;
24
+ padding: 0;
25
+ *zoom: 1;
26
+ }
27
+
28
+ .bx-wrapper img {
29
+ width: 100%;
30
+ display: block;
31
+ }
32
+
33
+ /** THEME
34
+ ===================================*/
35
+
36
+ .slideshow {
37
+ width: 960px;
38
+ min-height: 50px;
39
+ margin: auto;
40
+ }
41
+ .bxslider {
42
+ margin: 0px;
43
+ }
44
+
45
+ .bx-wrapper .bx-viewport {
46
+ -moz-box-shadow: 0 0 5px #ccc;
47
+ -webkit-box-shadow: 0 0 5px #ccc;
48
+ box-shadow: 0 0 5px #ccc;
49
+ }
50
+
51
+ .bx-wrapper .bx-pager,
52
+ .bx-wrapper .bx-controls-auto {
53
+ position: absolute;
54
+ bottom: -30px;
55
+ width: 100%;
56
+ }
57
+
58
+ /* LOADER */
59
+
60
+ .bx-wrapper .bx-loading {
61
+ min-height: 50px;
62
+ background: url(bx_loader.gif) center center no-repeat #fff;
63
+ height: 100%;
64
+ width: 100%;
65
+ position: absolute;
66
+ top: 0;
67
+ left: 0;
68
+ z-index: 2000;
69
+ }
70
+
71
+ /* PAGER */
72
+
73
+ .bx-wrapper .bx-pager {
74
+ text-align: center;
75
+ font-size: .85em;
76
+ font-family: Arial;
77
+ font-weight: bold;
78
+ color: #666;
79
+ padding-top: 20px;
80
+ }
81
+
82
+ .bx-wrapper .bx-pager .bx-pager-item,
83
+ .bx-wrapper .bx-controls-auto .bx-controls-auto-item {
84
+ display: inline-block;
85
+ *zoom: 1;
86
+ *display: inline;
87
+ }
88
+
89
+ .bx-wrapper .bx-pager.bx-default-pager a {
90
+ background: #666;
91
+ text-indent: -9999px;
92
+ display: block;
93
+ width: 10px;
94
+ height: 10px;
95
+ margin: 0 5px;
96
+ outline: 0;
97
+ -moz-border-radius: 5px;
98
+ -webkit-border-radius: 5px;
99
+ border-radius: 5px;
100
+ }
101
+
102
+ .bx-wrapper .bx-pager.bx-default-pager a:hover,
103
+ .bx-wrapper .bx-pager.bx-default-pager a.active {
104
+ background: #000;
105
+ }
106
+
107
+ /* DIRECTION CONTROLS (NEXT / PREV) */
108
+
109
+ .bx-wrapper .bx-prev {
110
+ left: 10px;
111
+ background: url(controls.png) no-repeat 0 -32px;
112
+ }
113
+
114
+ .bx-wrapper .bx-next {
115
+ right: 10px;
116
+ background: url(controls.png) no-repeat -43px -32px;
117
+ }
118
+
119
+ .bx-wrapper .bx-prev:hover {
120
+ background-position: 0 0;
121
+ }
122
+
123
+ .bx-wrapper .bx-next:hover {
124
+ background-position: -43px 0;
125
+ }
126
+
127
+ .bx-wrapper .bx-controls-direction a {
128
+ position: absolute;
129
+ top: 50%;
130
+ margin-top: -16px;
131
+ outline: 0;
132
+ width: 32px;
133
+ height: 32px;
134
+ text-indent: -9999px;
135
+ z-index: 9999;
136
+ }
137
+
138
+ .bx-wrapper .bx-controls-direction a.disabled {
139
+ display: none;
140
+ }
141
+
142
+ /* AUTO CONTROLS (START / STOP) */
143
+
144
+ .bx-wrapper .bx-controls-auto {
145
+ text-align: center;
146
+ }
147
+
148
+ .bx-wrapper .bx-controls-auto .bx-start {
149
+ display: block;
150
+ text-indent: -9999px;
151
+ width: 10px;
152
+ height: 11px;
153
+ outline: 0;
154
+ background: url(controls.png) -86px -11px no-repeat;
155
+ margin: 0 3px;
156
+ }
157
+
158
+ .bx-wrapper .bx-controls-auto .bx-start:hover,
159
+ .bx-wrapper .bx-controls-auto .bx-start.active {
160
+ background-position: -86px 0;
161
+ }
162
+
163
+ .bx-wrapper .bx-controls-auto .bx-stop {
164
+ display: block;
165
+ text-indent: -9999px;
166
+ width: 9px;
167
+ height: 11px;
168
+ outline: 0;
169
+ background: url(controls.png) -86px -44px no-repeat;
170
+ margin: 0 3px;
171
+ }
172
+
173
+ .bx-wrapper .bx-controls-auto .bx-stop:hover,
174
+ .bx-wrapper .bx-controls-auto .bx-stop.active {
175
+ background-position: -86px -33px;
176
+ }
177
+
178
+ /* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */
179
+
180
+ .bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager {
181
+ text-align: left;
182
+ width: 80%;
183
+ }
184
+
185
+ .bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto {
186
+ right: 0;
187
+ width: 35px;
188
+ }
189
+
190
+ /* IMAGE CAPTIONS */
191
+
192
+ .bx-wrapper .bx-caption {
193
+ position: absolute;
194
+ bottom: 0;
195
+ left: 0;
196
+ background: #666\9;
197
+ background: rgba(80, 80, 80, 0.75);
198
+ width: 100%;
199
+ }
200
+
201
+ .bx-wrapper .bx-caption span {
202
+ color: #fff;
203
+ font-family: Arial;
204
+ display: block;
205
+ font-size: .85em;
206
+ padding: 10px;
73
207
  }
@@ -7,17 +7,16 @@ class Admin::SlidesController < Admin::ResourceController
7
7
  end
8
8
 
9
9
  respond_to do |format|
10
- format.html { redirect_to admin_slideshow_type_slides_url(@slideshow_type) }
11
10
  format.js { render :text => 'Ok' }
12
11
  end
13
12
  end
14
13
 
15
14
  private
16
- def load_data
17
- @slideshow_type = SlideshowType.find(params[:slideshow_type_id])
18
- end
19
-
20
15
  def location_after_save
21
16
  admin_slideshow_type_slides_url(@slideshow_type)
22
17
  end
18
+
19
+ def load_data
20
+ @slideshow_type = SlideshowType.find(params[:slideshow_type_id])
21
+ end
23
22
  end
@@ -1,44 +1,45 @@
1
1
  module SlideshowTypesHelper
2
2
 
3
3
  def insert_slideshow(params={})
4
- if slide_images(params)
5
- navigation = enable_navigation(params)
6
- content_tag(:div, navigation[:prev] + content_tag(:div, content_tag(:ul, raw(slide_images(params))), :class => "frame") + navigation[:succ], :class => "gallery playing")
4
+ @@slideshow = Spree::SlideshowType.enable.find_by_category(params[:category])
5
+ if @@slideshow.blank? || (!@@slideshow.blank? && @@slideshow.slides.empty?)
6
+ return ''
7
7
  end
8
+ res = []
9
+
10
+ res << content_tag(:div, content_tag(:ul, slide_images(params, @@slideshow), :class => "bxslider"), :class => "slideshow")
11
+ res << "<script type='text/javascript'>
12
+ $(function() {
13
+ $('.bxslider').bxSlider({
14
+ adaptiveHeight: true,
15
+ controls: #{@@slideshow.enable_navigation},
16
+ autoStart: false,
17
+ infiniteLoop: false,
18
+ hideControlOnEnd: true
19
+ });
20
+ });
21
+ </script>"
22
+
23
+ res.join.html_safe
8
24
  end
25
+
26
+ def slide_images(params, slideshow)
27
+ params[:style] ||= "custom"
28
+ params[:show_content] ||= false
29
+ max = slideshow.slide_number || slideshow.slides.count
30
+ slides = slideshow.slides.limit(max).sort_by { |slide| slide.position }
9
31
 
10
- def slide_images(params)
11
- category = params[:category] || "home"
12
- style = params[:style] || "custom"
13
- slideshow = SlideshowType.enable(category)
14
- if !slideshow.blank?
15
- max = slideshow.first.slide_number || 4
16
- slides = Slide.where("slideshow_type_id = ?", slideshow.first.id).limit(max).sort_by { |slide| slide.position }
32
+ slides.map do |slide|
33
+ content_tag(:li, :class => "slide") do
34
+ divs = []
17
35
 
18
- slides.map do |slide|
19
- content_tag(:li, raw(link_to(image_tag(slide.attachment.url(style.to_sym)), slide.url, { :title => slide.title })) + raw(content_tag(:div, content_tag(:strong, raw(slide.title)), :class => "text-holder")))
20
- end.join
21
- else
22
- false
23
- end
24
- end
25
-
26
- def enable_navigation(params)
27
- category = params[:category] || "home"
28
- slideshow = SlideshowType.enable(category)
29
- if !slideshow.blank?
30
- if slideshow.first.enable_navigation
31
- prev = link_to("prev", "#", :class => "prev")
32
- succ = link_to("next", "#", :class => "next")
33
- else
34
- prev = ""
35
- succ = ""
36
+ divs << link_to(image_tag(slide.attachment.url(params[:style].to_sym)), (slide.url.blank? ? "javascript: void(0)" : slide.url), { :title => slide.title })
37
+ if params[:show_content]
38
+ divs << content_tag(:div, content_tag(:strong, raw(slide.title)) + content_tag(:p, raw(slide.content)), :class => "text-holder")
39
+ end
40
+
41
+ divs.join.html_safe
36
42
  end
37
- res = Hash.new()
38
- res[:prev] = prev
39
- res[:succ] = succ
40
- return res
41
- end
43
+ end.join.html_safe
42
44
  end
43
-
44
45
  end
data/app/models/slide.rb CHANGED
@@ -27,24 +27,11 @@ class Slide < ActiveRecord::Base
27
27
  validates_attachment_presence :attachment
28
28
  validates_attachment_content_type :attachment, :content_type => ['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/x-png', 'image/pjpeg'], :message => "deve essere JPG, JPEG, PNG o GIF"
29
29
 
30
- # save the w,h of the original image (from which others can be calculated)
31
- # we need to look at the write-queue for images which have not been saved yet
32
- after_post_process :find_dimensions
33
-
34
30
  def initialize(*args)
35
31
  super(*args)
36
32
  last_slide = Slide.last
37
33
  self.position = last_slide ? last_slide.position + 1 : 0
38
34
  end
39
-
40
- def find_dimensions
41
- temporary = attachment.queued_for_write[:original]
42
- filename = temporary.path unless temporary.nil?
43
- filename = attachment.path if filename.blank?
44
- geometry = Paperclip::Geometry.from_file(filename)
45
- self.attachment_width = geometry.width
46
- self.attachment_height = geometry.height
47
- end
48
35
 
49
36
  # if there are errors from the plugin, then add a more meaningful message
50
37
  def no_attachement_errors
@@ -1,11 +1,21 @@
1
1
  class SlideshowType < ActiveRecord::Base
2
2
  has_many :slides
3
+ after_update :reprocess_slides
3
4
 
4
- attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled
5
+ attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled, :enable_pagination
5
6
 
6
7
  validates :slide_number, :slide_width, :slide_height, :presence => true
7
8
  validates_uniqueness_of :category
8
9
  validates_numericality_of :slide_number, :only_integer => true
9
10
 
10
- scope :enable, lambda { |category| {:conditions => {:enabled => true, :category => category}} }
11
+ scope :enable, where("enabled IS NOT NULL AND enabled = 1")
12
+
13
+ def reprocess_slides
14
+ self.slides.each do |slide|
15
+ slide.attachment_width = self.slide_width
16
+ slide.attachment_height = self.slide_height
17
+ slide.save!
18
+ slide.attachment.reprocess!(:custom)
19
+ end
20
+ end
11
21
  end
@@ -1,3 +1,4 @@
1
+ <%= f.hidden_field(:slideshow_type_id, :value => @slideshow_type.id) %>
1
2
  <%= f.hidden_field(:attachment_width, :value => @slideshow_type.slide_width) %>
2
3
  <%= f.hidden_field(:attachment_height, :value => @slideshow_type.slide_height) %>
3
4
  <tr data-hook="file">
@@ -19,7 +19,7 @@
19
19
  <td class="actions">
20
20
  <%= link_to_with_icon 'edit', t(:edit), edit_admin_slideshow_type_slide_url(@slideshow_type, slide), :class => 'edit' %>
21
21
  &nbsp;
22
- <%= link_to_delete image, {:url => admin_slideshow_type_slide_url(@slideshow_type, slide) }%>
22
+ <%= link_to_delete slide, {:url => admin_slideshow_type_slide_url(@slideshow_type, slide) }%>
23
23
  </td>
24
24
  </tr>
25
25
  <% end %>
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: 0.70.71
4
+ version: 0.70.72
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: 2013-01-16 00:00:00.000000000 Z
12
+ date: 2013-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
@@ -70,6 +70,8 @@ files:
70
70
  - lib/generators/spree_multi_slideshow/install/install_generator.rb
71
71
  - lib/spree_multi_slideshow/engine.rb
72
72
  - lib/spree_multi_slideshow.rb
73
+ - app/assets/images/store/bx_loader.gif
74
+ - app/assets/images/store/controls.png
73
75
  - app/assets/images/store/slides/bg-gallery.png
74
76
  - app/assets/images/store/slides/bg-text02.png
75
77
  - app/assets/images/store/slides/sprite01.png