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 CHANGED
@@ -9,7 +9,7 @@ Basic Installation
9
9
 
10
10
  1. Add the following to your Gemfile
11
11
  <pre>
12
- gem 'spree_banner', '~> 1.0.8'
12
+ gem 'spree_banner', '~> 1.1.0'
13
13
  </pre>
14
14
  2. Run `bundle install`
15
15
  3. To copy and apply migrations run:
@@ -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 => Proc.new { |instance| "#{instance.attachment_width}x#{instance.attachment_height}#" }
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
- :storage => 's3',
29
- :s3_credentials => Rails.root.join('config', 's3.yml')
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
- :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
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, :attachment_content_type
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
@@ -1,3 +1,2 @@
1
1
  require 'spree_core'
2
- require 'formtastic'
3
2
  require 'spree_banner/engine'
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.8
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-25 00:00:00.000000000 Z
12
+ date: 2012-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core