effective_assets 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 683799595ae295b197a44f02b02a769932610fcc
4
- data.tar.gz: 28505119bba096a4952d6ddff8331dde8420bc6a
3
+ metadata.gz: c67c92237f6b56315688a9a7e3d99fda5003ae1a
4
+ data.tar.gz: 4342c97db0a74f2e3154feeb24d7f5ed3024aed0
5
5
  SHA512:
6
- metadata.gz: b8d0188295ccac3909e171064047f844ec53f841f9139a8739adcd2288482a01b595c34b355418b567771a45354d46ce68a4b3311452f2bb282901a44b34ce24
7
- data.tar.gz: a0902359371838357880728816d299a6fb23225cff4ef62ad456582e437ed20bf6dabf6c585374628c63e972666940e4d5ebde7c253c265cefe87517217a1482
6
+ metadata.gz: 72ad719b4aca16a29444fb9fabed8c9fa32ae455aaee367678f0083b16f049c20b5c5ca7dd5349019ebd7d9fe7e287e03b7b40367af588f27c0ba5040a7b43d7
7
+ data.tar.gz: 06128f78aa8bc3d1ba9201c8ddca3ae68bc034e3db7c6c8580ed9137a6a7a33104c6658e6ebca4f3d2f018752f25eecb0bc55d64dc736b587443082796e37661
data/README.md CHANGED
@@ -89,7 +89,7 @@ You will need an AWS IAM user with sufficient priviledges and a properly configu
89
89
 
90
90
  - Click Services -> S3 from the top-left menu
91
91
  - Click Create Bucket
92
- - Give the Bucket a name, and select the US Standard region
92
+ - Give the Bucket a name, and select the US Standard region
93
93
 
94
94
  ### Configure CORS Permissions
95
95
 
@@ -125,15 +125,22 @@ The Bucket is now set up and ready to accept uploads, but we still need a user t
125
125
 
126
126
  - Select Users from the left-side menu
127
127
  - Click Create New Users
128
+
128
129
  - Create just one user with any name
129
130
 
130
131
  - Expand the Show User Security Credentials
131
132
  - This displays the AWS Access Key and Secret Access Key.
132
133
  - (important) These are the two values you should copy into the effective_assets.rb initializer file
134
+ - Click Close. It's okay that you didn't download the credentials.
135
+
136
+ - Return to the Services -> IAM -> Users page
137
+ - Click on the name of the user you just created (not the checkbox, but the username text)
138
+
139
+ - Click Permissions tab
140
+ - Click Attach Policy
133
141
 
134
- - Once the user is created, Click on the User Properties area
135
- - Click Attach User Policy
136
- - Scroll down and Select 'Amazon S3 Full Access'
142
+ - Scroll down and Select 'AmazonS3FullAccess'
143
+ - Click Attach Policy
137
144
 
138
145
  This user is now set up and ready to access the S3 Bucket previously created
139
146
 
@@ -0,0 +1,104 @@
1
+ if defined?(ActiveAdmin)
2
+ ActiveAdmin.register Effective::Asset do
3
+ menu :label => "Assets", :if => proc { EffectiveAssets.authorized?(controller, :manage, Effective::Asset.new()) rescue false }
4
+
5
+ filter :title
6
+ filter :content_type
7
+ filter :created_at
8
+
9
+ scope :all, :default => true
10
+ scope :images
11
+ scope :videos
12
+ scope :files
13
+
14
+ index do
15
+ selectable_column
16
+
17
+ column 'Thumbnail' do |asset|
18
+ effective_asset_image_tag(asset, nil, {:height => 100, :width => 100})
19
+ end
20
+
21
+ column 'Title' do |asset|
22
+ strong asset.title
23
+ end
24
+
25
+ column 'Insert' do |asset|
26
+ ul :class => 'insert_links' do
27
+ if asset.image?
28
+ if asset.height.present? and asset.width.present?
29
+ li link_to "Insert as Original (#{asset.width}x#{asset.height}px)", '#', :class => 'asset-insertable', :data => { 'asset-id' => asset.id, 'asset' => effective_asset_image_tag(asset) }
30
+ else
31
+ li link_to 'Insert as Original', '#', :class => 'asset-insertable', :data => { 'asset-id' => asset.id, 'asset' => effective_asset_image_tag(asset) }
32
+ end
33
+
34
+ unless asset.processed?
35
+ li image_tag('/assets/effective_assets/spinner.gif', :alt => 'Generating additional image sizes...')
36
+ li 'Generating additional sizes...'
37
+ li "Please #{link_to 'Refresh', '#', :title => 'Refresh this page', :onclick => 'window.location.reload();'} in a moment.".html_safe
38
+ else
39
+ asset.versions_info.each do |title, dimensions|
40
+ li link_to "Insert as #{title.to_s.gsub('_',' ').titleize} (#{dimensions[:width]}x#{dimensions[:height]}px)", '#', :class => 'asset-insertable', :data => { 'asset-id' => asset.id, 'asset' => effective_asset_image_tag(asset) }
41
+ end
42
+ end
43
+
44
+ li link_to 'Reprocess all Versions', reprocess_admin_effective_asset_path(asset)
45
+
46
+ elsif asset.icon?
47
+ li link_to 'Insert icon', '#', :class => 'asset-insertable', :data => { 'asset-id' => asset.id, 'asset' => effective_asset_image_tag(asset) }
48
+
49
+ elsif asset.video?
50
+ li link_to 'Insert video', '#', :class => 'asset-insertable', :data => { 'asset-id' => asset.id, 'asset' => effective_asset_video_tag(asset) }
51
+
52
+ else
53
+ li link_to 'Insert link to file', '#', :class => 'asset-insertable', :data => { 'asset-id' => asset.id, 'asset' => effective_asset_link_to(asset) }
54
+ end
55
+ end
56
+ end
57
+
58
+ ActiveAdmin::VERSION.to_i >= 1 ? actions : default_actions
59
+ end
60
+
61
+ form :partial => "active_admin/effective_assets/form"
62
+
63
+ show :title => :title do
64
+ attributes_table do
65
+ row :title
66
+ row :content_type
67
+ row :created_at
68
+ row :thumb do
69
+ effective_asset_image_tag(effective_asset, nil, {:height => 100, :width => 100})
70
+ end
71
+ row :files do
72
+ ul do
73
+ if effective_asset.image?
74
+ li do
75
+ a :href => effective_asset.url, :target => "blank" do
76
+ "Original"
77
+ end
78
+ span "#{effective_asset.width || '?'}x#{effective_asset.height || '?'}px #{number_to_human_size(effective_asset.data_size, :precision => 3)}"
79
+ end
80
+
81
+ effective_asset.versions_info.each do |version, attributes|
82
+ li do
83
+ a :href => effective_asset.url(version), :target => 'blank' do
84
+ "#{version.to_s.gsub('_',' ').titleize}"
85
+ end
86
+ span "#{attributes[:width]}x#{attributes[:height]}px #{number_to_human_size(attributes[:data_size], :precision => 3)}"
87
+ end
88
+ end
89
+ else # Asset is not an image
90
+ li do
91
+ a :href => effective_asset.url do "#{effective_asset.file_name}" end
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+
99
+ member_action :reprocess, :method => :get do
100
+ asset = Effective::Asset.find(params[:id]).reprocess!
101
+ redirect_to admin_effective_assets_path
102
+ end
103
+ end
104
+ end
@@ -20,8 +20,20 @@ CKEDITOR.dialog.add 'effective_asset', (editor) ->
20
20
 
21
21
  $(this).contents().on 'click', 'a.attachment-insert', (event) ->
22
22
  event.preventDefault()
23
- dialog.setValueOf('asset', 'asset_id', $(event.currentTarget).data('asset-id'))
24
- dialog.setValueOf('asset', 'link_title', $($(event.currentTarget).data('asset')).text())
23
+ linkTitle = $($(event.currentTarget).data('asset')).text()
24
+
25
+ currentAssetId = dialog.getValueOf('asset', 'asset_id')
26
+ newAssetId = $(event.currentTarget).data('asset-id')
27
+ # if changing or initializing the attachment
28
+ if currentAssetId != newAssetId
29
+ dialog.setValueOf('asset', 'asset_id', newAssetId)
30
+ # if initializing the attachment
31
+ if currentAssetId == ''
32
+ # try to set the link title based on a given link title
33
+ givenLinkTitle = dialog.getContentElement('asset', 'link_title').getValue()
34
+ linkTitle = givenLinkTitle if givenLinkTitle.length > 0
35
+
36
+ dialog.setValueOf('asset', 'link_title', linkTitle)
25
37
  dialog.commitContent()
26
38
  dialog.click('ok')
27
39
  }
@@ -6,4 +6,5 @@
6
6
  - elsif asset.image?
7
7
  = effective_asset_image_tag(asset, nil, :class => effective_asset.html_class)
8
8
  - else
9
- = effective_asset_link_to(asset, nil, :class => effective_asset.html_class, :title => effective_asset.link_title.presence)
9
+ %span.effective-assets-asset-link{data: {'content-type' => asset.content_type}}
10
+ = effective_asset_link_to(asset, nil, :class => effective_asset.html_class, :title => effective_asset.link_title.presence)
@@ -1,3 +1,3 @@
1
1
  module EffectiveAssets
2
- VERSION = '1.5.0'.freeze
2
+ VERSION = '1.5.1'.freeze
3
3
  end
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.5.0
4
+ version: 1.5.1
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: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: unf
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: haml
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -175,6 +161,7 @@ files:
175
161
  - MIT-LICENSE
176
162
  - README.md
177
163
  - Rakefile
164
+ - active_admin/effective_assets.rb
178
165
  - app/assets/images/effective_assets/icon_close.png
179
166
  - app/assets/images/effective_assets/spinner.gif
180
167
  - app/assets/images/mime-types/excel.jpg