spree_multi_slideshow 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/app/models/spree/slide.rb +10 -8
- data/app/models/spree/slideshow_type.rb +2 -2
- data/lib/spree_multi_slideshow.rb +0 -2
- metadata +2 -2
data/README.md
CHANGED
data/app/models/spree/slide.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
module Spree
|
2
|
-
class Slide < ActiveRecord::Base
|
2
|
+
class Slide < ActiveRecord::Base
|
3
3
|
belongs_to :slideshow_type
|
4
4
|
|
5
5
|
attr_accessor :attachment_width, :attachment_height
|
6
|
-
attr_accessible :title, :url, :attachment_width, :attachment_height, :content, :slideshow_type_id, :attachment
|
6
|
+
attr_accessible :title, :url, :attachment_width, :attachment_height, :content, :slideshow_type_id, :attachment
|
7
7
|
|
8
8
|
has_attached_file :attachment,
|
9
9
|
:url => "/spree/slides/:id/:style_:basename.:extension",
|
10
10
|
:path => ":rails_root/public/spree/slides/:id/:style_:basename.:extension",
|
11
|
-
:styles => {
|
11
|
+
:styles => lambda {|a|
|
12
|
+
{
|
12
13
|
:thumbnail => "100x33#",
|
13
|
-
:small =>
|
14
|
+
:small => "300x100#",
|
14
15
|
:medium => "600x200#",
|
15
|
-
:slide =>
|
16
|
-
:custom =>
|
16
|
+
:slide => "900x300#",
|
17
|
+
:custom => "#{a.instance.attachment_width}x#{a.instance.attachment_height}#"
|
18
|
+
}
|
17
19
|
},
|
18
20
|
:convert_options => {
|
19
21
|
:thumbnail => "-gravity center",
|
@@ -28,12 +30,12 @@ module Spree
|
|
28
30
|
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
31
|
|
30
32
|
# Load S3 settings
|
31
|
-
if (FileTest.exist?(Rails.root.join('config', 's3.yml')) && !YAML.load_file(Rails.root.join('config', 's3.yml'))[Rails.env].blank?)
|
33
|
+
if ( FileTest.exist?(Rails.root.join('config', 's3.yml')) && !YAML.load_file(Rails.root.join('config', 's3.yml'))[Rails.env].blank?)
|
32
34
|
S3_OPTIONS = {
|
33
35
|
:storage => 's3',
|
34
36
|
:s3_credentials => Rails.root.join('config', 's3.yml')
|
35
37
|
}
|
36
|
-
elsif (FileTest.exist?(Rails.root.join('config', 's3.yml'))
|
38
|
+
elsif (FileTest.exist?(Rails.root.join('config', 's3.yml')) &&!ENV['S3_KEY'].blank? && !ENV['S3_SECRET'].blank? && !ENV['S3_BUCKET'].blank?)
|
37
39
|
S3_OPTIONS = {
|
38
40
|
:storage => 's3',
|
39
41
|
:s3_credentials => {
|
@@ -2,8 +2,8 @@ module Spree
|
|
2
2
|
class SlideshowType < ActiveRecord::Base
|
3
3
|
has_many :slides
|
4
4
|
|
5
|
-
attr_accessible :category, :
|
6
|
-
|
5
|
+
attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled
|
6
|
+
|
7
7
|
validates :slide_number, :slide_width, :slide_height, :presence => true
|
8
8
|
validates_uniqueness_of :category
|
9
9
|
validates_numericality_of :slide_number, :only_integer => true
|
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.0
|
4
|
+
version: 1.1.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-07-
|
12
|
+
date: 2012-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|