effective_assets 1.9.1 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/effective_assets/s3_uploader.js.coffee +1 -1
- data/app/models/effective/asset.rb +9 -13
- data/app/uploaders/effective_assets_uploader.rb +14 -0
- data/app/uploaders/test_asset_uploader.rb +1 -1
- data/lib/effective_assets/version.rb +1 -1
- data/lib/generators/templates/asset_uploader.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 270d9c01d088e1274797ab996187bc92f77564c3
|
4
|
+
data.tar.gz: 590af797beb1b2b7014ff636806d509038c2cebd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68913570e88a23c127f525cf1fc9a3ca0bd87aa329f98551592a6423ba3705ed87192e677537cc33eec0180c5c3f6431062a1076e60d01cc0b140bfd17572f33
|
7
|
+
data.tar.gz: d6a316a1f9b3d314a79322eb47606fc10b40307657de82537643c00944c78530bda477a1a9101e425590aa885fb85bbf9842045758297382da1694b6ed80e3cc
|
@@ -156,7 +156,7 @@ $.fn.S3Uploader = (options) ->
|
|
156
156
|
|
157
157
|
content.filename = file.name
|
158
158
|
content.filesize = file.size if 'size' of file
|
159
|
-
content.
|
159
|
+
content.lastModified = file.lastModified if 'lastModified' of file
|
160
160
|
content.filetype = file.type if 'type' of file
|
161
161
|
content.asset_id = file.asset_id if 'asset_id' of file
|
162
162
|
content.relativePath = build_relativePath(file) if has_relativePath(file)
|
@@ -17,7 +17,7 @@ module Effective
|
|
17
17
|
# 3. But it doesn't belong to anything yet. It might be attached to a user's asset_boxes, or a page, or a post through attachments
|
18
18
|
#
|
19
19
|
|
20
|
-
has_many :attachments, :
|
20
|
+
has_many :attachments, dependent: :delete_all
|
21
21
|
|
22
22
|
# structure do
|
23
23
|
# title :string
|
@@ -125,6 +125,10 @@ module Effective
|
|
125
125
|
end
|
126
126
|
end # End of Class methods
|
127
127
|
|
128
|
+
def to_s
|
129
|
+
title
|
130
|
+
end
|
131
|
+
|
128
132
|
def title
|
129
133
|
self[:title].presence || file_name
|
130
134
|
end
|
@@ -172,26 +176,18 @@ module Effective
|
|
172
176
|
content_type.include? 'audio/'
|
173
177
|
end
|
174
178
|
|
179
|
+
def placeholder?
|
180
|
+
upload_file.blank? || upload_file == 'placeholder'.freeze
|
181
|
+
end
|
182
|
+
|
175
183
|
def versions_info
|
176
184
|
self[:versions_info] || {}
|
177
185
|
end
|
178
186
|
|
179
|
-
def to_s
|
180
|
-
title
|
181
|
-
end
|
182
187
|
|
183
|
-
def placeholder?
|
184
|
-
upload_file.blank? || upload_file == 'placeholder'.freeze
|
185
|
-
end
|
186
188
|
|
187
189
|
# This method is called asynchronously by an after_commit filter
|
188
190
|
def process!
|
189
|
-
# Make sure carrierwave-aws sets the correct permissions
|
190
|
-
if data.respond_to?(:aws_acl) && aws_acl.present?
|
191
|
-
data.aws_acl = aws_acl
|
192
|
-
data.versions.each { |_, data| data.aws_acl = aws_acl }
|
193
|
-
end
|
194
|
-
|
195
191
|
if placeholder?
|
196
192
|
puts 'Placeholder Asset processing not required (this is a soft error)'
|
197
193
|
# Do nothing
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class EffectiveAssetsUploader < CarrierWave::Uploader::Base
|
2
2
|
include CarrierWave::MiniMagick
|
3
3
|
|
4
|
+
storage :aws
|
5
|
+
|
4
6
|
def store_dir
|
5
7
|
"#{EffectiveAssets.aws_path.chomp('/')}/#{model.id.to_i}"
|
6
8
|
end
|
@@ -23,6 +25,18 @@ class EffectiveAssetsUploader < CarrierWave::Uploader::Base
|
|
23
25
|
@aws_authenticated_url_expiration = expires_in
|
24
26
|
end
|
25
27
|
|
28
|
+
def aws_acl
|
29
|
+
model.aws_acl
|
30
|
+
end
|
31
|
+
|
32
|
+
def aws_write_options
|
33
|
+
{ acl: aws_acl }
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.image?
|
37
|
+
proc { |uploader| (uploader.model.image? rescue false) }
|
38
|
+
end
|
39
|
+
|
26
40
|
protected
|
27
41
|
|
28
42
|
# record_info
|
@@ -17,7 +17,7 @@ class TestAssetUploader < EffectiveAssetsUploader
|
|
17
17
|
# Keep in mind, resize_to_fit will scale up images if they are smaller than 100px.
|
18
18
|
# If you don't want it to do that, then replace that with resize_to_limit.
|
19
19
|
|
20
|
-
version :thumb, :if =>
|
20
|
+
version :thumb, :if => image? do
|
21
21
|
process :resize_to_fit => [70, 70]
|
22
22
|
process :record_info => :thumb
|
23
23
|
end
|
@@ -17,7 +17,7 @@ class AssetUploader < EffectiveAssetsUploader
|
|
17
17
|
# Keep in mind, resize_to_fit will scale up images if they are smaller than 100px.
|
18
18
|
# If you don't want it to do that, then replace that with resize_to_limit.
|
19
19
|
|
20
|
-
version :thumb, :
|
20
|
+
version :thumb, if: image? do
|
21
21
|
process :resize_to_fit => [70, 70]
|
22
22
|
process :record_info => :thumb
|
23
23
|
# process :watermark! => [70, 70]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|