effective_assets 1.6.9 → 1.7.0
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.
- checksums.yaml +4 -4
- data/app/controllers/effective/assets_controller.rb +1 -1
- data/app/controllers/effective/s3_uploads_controller.rb +10 -5
- data/app/models/concerns/acts_as_asset_box.rb +4 -4
- data/app/models/effective/iframe_uploads.rb +8 -0
- data/app/views/effective/style_guide/_effective_assets.html.haml +24 -0
- data/lib/effective_assets/version.rb +1 -1
- data/lib/generators/templates/effective_assets.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e5b0e16ffa38f1ce220cc208ff42d4418f13d25
|
4
|
+
data.tar.gz: bc514be07640f7796280e5c33e7381c82bf87d99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74576b1a834817fcbc24de46002c63dc972028e5df144b25bf54075aeac861359e16d5d9581ee76c7b367c5f2926d20fea083990aa36f67e3c94309e1b54540a
|
7
|
+
data.tar.gz: a0c4b89d9cf2f3d6aa0e078bf21f3ffe5e9ed1c38c5109fcfa68c1fd68ae91823f2900fa69c3f15466f521447c7dee36c4af4d0dc52e607264264b06b656796c
|
@@ -9,7 +9,7 @@ module Effective
|
|
9
9
|
EffectiveAssets.authorized?(self, :index, Effective::Asset.new(:user_id => current_user.try(:id)))
|
10
10
|
|
11
11
|
effective_iframe_uploads = Effective::Attachment.where(box: EffectiveAssets::IFRAME_UPLOADS).pluck(:asset_id)
|
12
|
-
@assets =
|
12
|
+
@assets = Effective::Asset.where(id: effective_iframe_uploads)
|
13
13
|
|
14
14
|
if params[:only] == 'images'
|
15
15
|
@assets = @assets.images
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module Effective
|
2
2
|
class S3UploadsController < ApplicationController
|
3
3
|
skip_authorization_check if defined?(CanCan)
|
4
|
-
|
4
|
+
|
5
|
+
if respond_to?(:skip_before_action)
|
6
|
+
skip_before_action(:verify_authenticity_token)
|
7
|
+
else
|
8
|
+
skip_before_filter(:verify_authenticity_token)
|
9
|
+
end
|
5
10
|
|
6
11
|
# When we create an Asset, we're effectively reserving the ID
|
7
12
|
# But the Asset itself isn't really there or uploaded yet.
|
@@ -16,9 +21,9 @@ module Effective
|
|
16
21
|
|
17
22
|
begin
|
18
23
|
@asset.save!
|
19
|
-
render(:
|
24
|
+
render(:body => {:id => @asset.id, :s3_key => asset_s3_key(@asset)}.to_json, :status => 200)
|
20
25
|
rescue => e
|
21
|
-
render(:
|
26
|
+
render(:body => e.message, :status => 500)
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
@@ -29,7 +34,7 @@ module Effective
|
|
29
34
|
|
30
35
|
unless params[:skip_update] # This is useful for the acts_as_asset_box Attach action
|
31
36
|
if update_placeholder_asset(@asset, params) == false
|
32
|
-
render :
|
37
|
+
render :body => '', :status => :unprocessable_entity
|
33
38
|
return
|
34
39
|
end
|
35
40
|
end
|
@@ -63,7 +68,7 @@ module Effective
|
|
63
68
|
|
64
69
|
render :partial => "asset_box_input/#{attachment_partial}", :locals => {:attachment => attachment, :attachable_object_name => attachable_object_name, :attachment_actions => attachment_actions, attachment_links: attachment_links}, :status => 200, :content_type => 'text/html'
|
65
70
|
else
|
66
|
-
render :
|
71
|
+
render :body => '', :status => 200
|
67
72
|
end
|
68
73
|
end
|
69
74
|
|
@@ -34,8 +34,8 @@ module ActsAsAssetBox
|
|
34
34
|
end
|
35
35
|
|
36
36
|
included do
|
37
|
-
has_many :attachments, :as => :attachable, :class_name =>
|
38
|
-
has_many :assets, :through => :attachments, :class_name =>
|
37
|
+
has_many :attachments, :as => :attachable, :class_name => 'Effective::Attachment', :dependent => :delete_all
|
38
|
+
has_many :assets, :through => :attachments, :class_name => 'Effective::Asset'
|
39
39
|
|
40
40
|
accepts_nested_attributes_for :attachments, :reject_if => :all_blank, :allow_destroy => true
|
41
41
|
|
@@ -90,7 +90,7 @@ module ActsAsAssetBox
|
|
90
90
|
if box == boxes
|
91
91
|
attachments.map { |attachment| attachment.asset if attachment.box == boxes }.compact
|
92
92
|
else
|
93
|
-
attachments.sort_by
|
93
|
+
attachments.sort_by { |attachment| attachment.position }.find { |attachment| attachment.box == boxes }.try(:asset)
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -134,7 +134,7 @@ module ActsAsAssetBox
|
|
134
134
|
attachment.asset = item
|
135
135
|
end
|
136
136
|
|
137
|
-
attachments.to_a.sort_by!
|
137
|
+
attachments.to_a.sort_by! { |attachment| attachment.position }
|
138
138
|
|
139
139
|
true
|
140
140
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
= simple_form_for Effective::StyleGuide.new(), :url => '/' do |f|
|
2
|
+
= f.input :files,
|
3
|
+
:as => :asset_box,
|
4
|
+
:hint => 'default display (same as attachment_style: :thumbnail)'
|
5
|
+
|
6
|
+
= f.input :files,
|
7
|
+
:as => :asset_box,
|
8
|
+
:attachment_style => :table,
|
9
|
+
:hint => 'display as table (attachment_style: :table)'
|
10
|
+
|
11
|
+
= f.input :files,
|
12
|
+
:as => :asset_box,
|
13
|
+
:attachment_style => :list,
|
14
|
+
:hint => 'display as list (attachment_style: :list)'
|
15
|
+
|
16
|
+
= f.input :files,
|
17
|
+
:as => :asset_box,
|
18
|
+
:dialog => true,
|
19
|
+
:hint => 'with attachment dialog (dialog: true)'
|
20
|
+
|
21
|
+
= f.input :files,
|
22
|
+
:as => :asset_box,
|
23
|
+
:uploader_drop_files => true,
|
24
|
+
:hint => 'with drop zone (uploader_drop_files: true)'
|
@@ -4,7 +4,7 @@ EffectiveAssets.setup do |config|
|
|
4
4
|
config.assets_table_name = :assets
|
5
5
|
config.attachments_table_name = :attachments
|
6
6
|
|
7
|
-
config.uploader =
|
7
|
+
config.uploader = AssetUploader # Must extend from EffectiveAssetsUploader
|
8
8
|
|
9
9
|
# Authorization Method
|
10
10
|
#
|
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.
|
4
|
+
version: 1.7.0
|
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: 2016-08-
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- app/views/effective/assets/_video.html.erb
|
207
207
|
- app/views/effective/assets/iframe.html.haml
|
208
208
|
- app/views/effective/snippets/_effective_asset.html.haml
|
209
|
+
- app/views/effective/style_guide/_effective_assets.html.haml
|
209
210
|
- config/routes.rb
|
210
211
|
- db/migrate/01_create_effective_assets.rb.erb
|
211
212
|
- lib/effective_assets.rb
|