spree_banner 1.0.8 → 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/banner.rb +16 -16
- data/db/migrate/20120116204313_create_banners.rb +1 -1
- data/lib/spree_banner.rb +0 -1
- metadata +2 -2
data/README.md
CHANGED
data/app/models/spree/banner.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Spree
|
2
2
|
class Banner < ActiveRecord::Base
|
3
3
|
attr_accessible :title, :url, :category, :position, :enabled, :attachment, :attachment_width, :attachment_height
|
4
|
-
|
4
|
+
|
5
5
|
has_attached_file :attachment,
|
6
6
|
:url => "/spree/banner/:id/:style_:basename.:extension",
|
7
7
|
:path => ":rails_root/public/spree/banner/:id/:style_:basename.:extension",
|
8
8
|
#:default_url => "/missing/:style.jpg",
|
9
|
-
:styles => {
|
9
|
+
:styles => lambda {|a|
|
10
10
|
:thumbnail => "80x80#",
|
11
|
-
:custom =>
|
11
|
+
:custom => "#{a.instance.attachment_width}x#{a.instance.attachment_height}#"
|
12
12
|
},
|
13
13
|
:convert_options => {
|
14
14
|
:thumbnail => "-gravity center"
|
@@ -25,21 +25,21 @@ module Spree
|
|
25
25
|
# Load S3 settings
|
26
26
|
if (FileTest.exist?(Rails.root.join('config', 's3.yml')) && !YAML.load_file(Rails.root.join('config', 's3.yml'))[Rails.env].blank?)
|
27
27
|
S3_OPTIONS = {
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
:storage => 's3',
|
29
|
+
:s3_credentials => Rails.root.join('config', 's3.yml')
|
30
|
+
}
|
31
31
|
elsif (FileTest.exist?(Rails.root.join('config', 's3.yml')) && ENV['S3_KEY'] && ENV['S3_SECRET'] && ENV['S3_BUCKET'])
|
32
32
|
S3_OPTIONS = {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
:storage => 's3',
|
34
|
+
:s3_credentials => {
|
35
|
+
:access_key_id => ENV['S3_KEY'],
|
36
|
+
:secret_access_key => ENV['S3_SECRET']
|
37
|
+
},
|
38
|
+
:bucket => ENV['S3_BUCKET']
|
39
|
+
}
|
40
|
+
else
|
41
|
+
S3_OPTIONS = { :storage => 'filesystem' }
|
42
|
+
end
|
43
43
|
|
44
44
|
attachment_definitions[:attachment] = (attachment_definitions[:attachment] || {}).merge(S3_OPTIONS)
|
45
45
|
|
@@ -6,7 +6,7 @@ class CreateBanners < ActiveRecord::Migration
|
|
6
6
|
t.integer :position
|
7
7
|
t.boolean :enabled
|
8
8
|
|
9
|
-
t.string :attachment_content_type, :attachment_file_name
|
9
|
+
t.string :attachment_content_type, :attachment_file_name
|
10
10
|
t.datetime :attachment_updated_at
|
11
11
|
t.integer :attachment_width, :attachment_height, :default => 100
|
12
12
|
t.integer :attachment_size
|
data/lib/spree_banner.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_banner
|
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
|