spree_multi_slideshow 0.70.8 → 0.70.71

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.
@@ -2,206 +2,72 @@
2
2
  *= require store/spree_core
3
3
  */
4
4
 
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;
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;
207
73
  }
@@ -7,16 +7,17 @@ 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) }
10
11
  format.js { render :text => 'Ok' }
11
12
  end
12
13
  end
13
14
 
14
15
  private
15
- def location_after_save
16
- admin_slideshow_type_slides_url(@slideshow_type)
17
- end
18
-
19
16
  def load_data
20
17
  @slideshow_type = SlideshowType.find(params[:slideshow_type_id])
21
18
  end
19
+
20
+ def location_after_save
21
+ admin_slideshow_type_slides_url(@slideshow_type)
22
+ end
22
23
  end
@@ -1,47 +1,44 @@
1
1
  module SlideshowTypesHelper
2
2
 
3
3
  def insert_slideshow(params={})
4
- @@slideshow = SlideshowType.enable.find_by_category(params[:category])
5
- if @@slideshow.blank? || (!@@slideshow.blank? && @@slideshow.slides.empty?)
6
- return ''
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")
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
- speed: #{params[:speed] || 500},
16
- mode: '#{params[:mode] || "horizontal"}',
17
- controls: #{@@slideshow.enable_navigation},
18
- auto: #{params[:auto_start] || "false"},
19
- infiniteLoop: #{params[:infinite_loop] || "false"},
20
- hideControlOnEnd: #{params[:hide_on_end] || "true"}
21
- });
22
- });
23
- </script>"
24
-
25
- res.join.html_safe
26
8
  end
27
-
28
- def slide_images(params, slideshow)
29
- params[:style] ||= "custom"
30
- params[:show_content] ||= false
31
- max = slideshow.slide_number || slideshow.slides.count
32
- slides = slideshow.slides.limit(max).sort_by { |slide| slide.position }
33
-
34
- slides.map do |slide|
35
- content_tag(:li, :class => "slide") do
36
- divs = []
37
9
 
38
- divs << link_to(image_tag(slide.attachment.url(params[:style].to_sym)), (slide.url.blank? ? "javascript: void(0)" : slide.url), { :title => slide.title })
39
- if params[:show_content]
40
- divs << content_tag(:div, content_tag(:strong, raw(slide.title)) + content_tag(:p, raw(slide.content)), :class => "text-holder")
41
- end
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 }
42
17
 
43
- divs.join.html_safe
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 = ""
44
36
  end
45
- end.join.html_safe
37
+ res = Hash.new()
38
+ res[:prev] = prev
39
+ res[:succ] = succ
40
+ return res
41
+ end
46
42
  end
43
+
47
44
  end
data/app/models/slide.rb CHANGED
@@ -27,11 +27,24 @@ 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
+
30
34
  def initialize(*args)
31
35
  super(*args)
32
36
  last_slide = Slide.last
33
37
  self.position = last_slide ? last_slide.position + 1 : 0
34
38
  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
35
48
 
36
49
  # if there are errors from the plugin, then add a more meaningful message
37
50
  def no_attachement_errors
@@ -1,21 +1,11 @@
1
1
  class SlideshowType < ActiveRecord::Base
2
2
  has_many :slides
3
- after_update :reprocess_slides
4
3
 
5
- attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled, :enable_pagination
4
+ attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled
6
5
 
7
6
  validates :slide_number, :slide_width, :slide_height, :presence => true
8
7
  validates_uniqueness_of :category
9
8
  validates_numericality_of :slide_number, :only_integer => true
10
9
 
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
10
+ scope :enable, lambda { |category| {:conditions => {:enabled => true, :category => category}} }
21
11
  end
@@ -1,4 +1,3 @@
1
- <%= f.hidden_field(:slideshow_type_id, :value => @slideshow_type.id) %>
2
1
  <%= f.hidden_field(:attachment_width, :value => @slideshow_type.slide_width) %>
3
2
  <%= f.hidden_field(:attachment_height, :value => @slideshow_type.slide_height) %>
4
3
  <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 slide, {:url => admin_slideshow_type_slide_url(@slideshow_type, slide) }%>
22
+ <%= link_to_delete image, {: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.8
4
+ version: 0.70.71
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-02-27 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
@@ -70,8 +70,6 @@ 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
75
73
  - app/assets/images/store/slides/bg-gallery.png
76
74
  - app/assets/images/store/slides/bg-text02.png
77
75
  - app/assets/images/store/slides/sprite01.png