effective_assets 1.9.14 → 1.11.2

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
- SHA1:
3
- metadata.gz: 83b563d9bd1167133ad1f6584893f76f82f16e36
4
- data.tar.gz: 5ec222a0c56d2b8a4a6f077e4d9f7877297b42e8
2
+ SHA256:
3
+ metadata.gz: 4704539ad2f751c0557b6484993d5a7b1eec4f395b14850fb98555d50a3487a9
4
+ data.tar.gz: a943ad172052ae93362088e32df9c29fb77e07850bec9314291df85f13af4a26
5
5
  SHA512:
6
- metadata.gz: 738a48fb236386ba724496fe225854df828d8bb5f4c588d84b6a0080f0efbec737701c80ee92d93304e84ea05625b26fcf4d64b32e371d026f1dfc31986638e3
7
- data.tar.gz: 8143da9f67e215f5e548582a8f126218c9db2270039beea295421ef3a4e44bc36dcfb207de1380d84bd84f384c398c78975d6294f115f1d9e94e1f02c4794b40
6
+ metadata.gz: 4a56ff3ae576698f4809cb3c4eefdf04b0e228eadb824fd5787d219a25c64b747fbb8181b9e4f7885897e38cfe0235fd5de7feabf6ce01e9f0cb1a3d8863f266
7
+ data.tar.gz: 7800e3fe6cb6915866ca2539e79b4e6108e4e76d7d01594beb3da180110b1f7db3680cfa2e3d73aa8ef5fd149925e9dc13e0cd062324477b6438e94fef235df3
@@ -1,4 +1,4 @@
1
- Copyright 2017 Code and Effect Inc.
1
+ Copyright 2020 Code and Effect Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,2 @@
1
+ //= link_directory ../images/mime-types
2
+ //= link_directory ../images/effective_assets
@@ -11,7 +11,7 @@ CKEDITOR.dialog.add 'effective_asset', (editor) ->
11
11
  {
12
12
  id: 'iframe-insert',
13
13
  type: 'html',
14
- html: "<div><p id='iframe-insert-loading' style='text-align: center;'><br><br><br><br><br><br><img src='<%= asset_path('effective_assets/spinner.gif') %>' /><br><br>&nbsp;&nbsp;&nbsp;Loading...</p><iframe class='effective_assets_iframe' style='width: 100%; height: 100%; min-height: 500px;' src='/effective/assets?only=nonimages'></iframe></div>"
14
+ html: "<div><p id='iframe-insert-loading' style='text-align: center;'><br><br><br><br><br><br><br><br>&nbsp;&nbsp;&nbsp;Loading...</p><iframe class='effective_assets_iframe' style='width: 100%; height: 100%; min-height: 500px;' src='/effective/assets?only=nonimages'></iframe></div>"
15
15
  onLoad: (evt) ->
16
16
  dialog = evt.sender # This is the CKEditor.dialog
17
17
  iframe = $('#' + dialog.getContentElement('upload', 'iframe-insert').domId).children('iframe').first()
@@ -8,8 +8,7 @@ module Effective
8
8
  def index # This is the IFRAME modal dialog that is read by CKEDITOR
9
9
  EffectiveAssets.authorized?(self, :index, Effective::Asset.new(:user_id => current_user.try(:id)))
10
10
 
11
- effective_iframe_uploads = Effective::Attachment.where(box: EffectiveAssets::IFRAME_UPLOADS).pluck(:asset_id)
12
- @assets = Effective::Asset.where(id: effective_iframe_uploads)
11
+ @assets = Effective::Asset.where(user_id: current_user.id)
13
12
 
14
13
  if params[:only] == 'images'
15
14
  @assets = @assets.images
@@ -21,7 +20,7 @@ module Effective
21
20
  @aws_acl = EffectiveAssets.aws_acl
22
21
  end
23
22
 
24
- @user_uploads = IframeUploads.new(@assets)
23
+ @user_uploads = IframeUpload.new(@assets)
25
24
 
26
25
  render :file => 'effective/assets/iframe'
27
26
  end
@@ -0,0 +1,13 @@
1
+ # This is a class used for the IFrame views
2
+
3
+ module Effective
4
+ class IframeUpload < ActiveRecord::Base
5
+ acts_as_asset_box :uploads
6
+
7
+ def initialize(items = nil)
8
+ super()
9
+ add_to_asset_box(:uploads, items)
10
+ end
11
+
12
+ end
13
+ end
@@ -2,10 +2,14 @@ if defined?(EffectiveRegions)
2
2
  module Effective
3
3
  module Snippets
4
4
  class EffectiveAsset < Snippet
5
- attribute :asset_id, Integer
6
- attribute :html_class, String
7
- attribute :link_title, String
8
- attribute :private_url, Boolean
5
+ # attr_accessor :asset_id #, Integer
6
+ # attr_accessor :html_class #, String
7
+ # attr_accessor :link_title #, String
8
+ # attr_accessor :private_url # , Boolean
9
+
10
+ def snippet_attributes
11
+ super + [:asset_id, :html_class, :link_title, :private_url]
12
+ end
9
13
 
10
14
  def asset
11
15
  @asset ||= (Effective::Asset.where(:id => asset_id).first if asset_id)
@@ -20,7 +24,7 @@ if defined?(EffectiveRegions)
20
24
  end
21
25
 
22
26
  def is_private?
23
- private_url == true
27
+ [true, 'true', '1'].include?(private_url)
24
28
  end
25
29
 
26
30
  def aws_private?
@@ -73,7 +73,9 @@ class EffectiveAssetsUploader < CarrierWave::Uploader::Base
73
73
  retval = {}
74
74
 
75
75
  self.class.versions.each do |k, v|
76
- v[:uploader].processors.each do |processor|
76
+ processors = (v.respond_to?(:processors) ? v.processors : v[:uploader].processors)
77
+
78
+ processors.each do |processor|
77
79
  dimensions = processor[1]
78
80
 
79
81
  if processor[0].to_s.include?('resize') and dimensions.kind_of?(Array) and dimensions.length == 2
@@ -1,6 +1,7 @@
1
1
  EffectiveAssets.setup do |config|
2
2
  config.assets_table_name = :assets
3
3
  config.attachments_table_name = :attachments
4
+ config.iframe_uploads_table_name = :iframe_uploads
4
5
 
5
6
  config.uploader = 'AssetUploader' # Must extend from EffectiveAssetsUploader
6
7
 
@@ -31,6 +31,10 @@ class CreateEffectiveAssets < ActiveRecord::Migration[4.2]
31
31
  t.string :box
32
32
  end
33
33
 
34
+ create_table <%= @iframe_uploads_table_name %> do |t|
35
+ t.timestamps
36
+ end
37
+
34
38
  add_index <%= @attachments_table_name %>, :asset_id
35
39
  add_index <%= @attachments_table_name %>, [:attachable_type, :attachable_id]
36
40
  add_index <%= @attachments_table_name %>, :attachable_id
@@ -11,6 +11,7 @@ module EffectiveAssets
11
11
  # The following are all valid config keys
12
12
  mattr_accessor :assets_table_name
13
13
  mattr_accessor :attachments_table_name
14
+ mattr_accessor :iframe_uploads_table_name
14
15
 
15
16
  mattr_accessor :uploader
16
17
  mattr_accessor :async
@@ -2,8 +2,6 @@ module EffectiveAssets
2
2
  class Engine < ::Rails::Engine
3
3
  engine_name 'effective_assets'
4
4
 
5
- config.autoload_paths += Dir["#{config.root}/app/models/**/", "#{config.root}/app/jobs/**/"]
6
-
7
5
  # Include acts_as_addressable concern and allow any ActiveRecord object to call it
8
6
  initializer 'effective_assets.active_record' do |app|
9
7
  ActiveSupport.on_load :active_record do
@@ -23,7 +21,10 @@ module EffectiveAssets
23
21
  end
24
22
 
25
23
  initializer "effective_assets.append_precompiled_assets" do |app|
26
- Rails.application.config.assets.precompile += ['effective_assets.js', 'effective_assets_iframe.js', 'effective_assets_iframe.css', 'effective_assets/*', 'mime-types/*']
24
+ Rails.application.config.assets.precompile += [
25
+ 'effective_assets_manifest.js', 'effective_assets.js', 'effective_assets_iframe.js', 'effective_assets_iframe.css',
26
+ 'effective_assets/*', 'mime-types/*'
27
+ ]
27
28
  end
28
29
 
29
30
  # ActiveAdmin (optional)
@@ -1,3 +1,3 @@
1
1
  module EffectiveAssets
2
- VERSION = '1.9.14'.freeze
2
+ VERSION = '1.11.2'.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.9.14
4
+ version: 1.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-06 00:00:00.000000000 Z
11
+ date: 2020-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -133,6 +133,7 @@ files:
133
133
  - MIT-LICENSE
134
134
  - README.md
135
135
  - active_admin/effective_assets.rb
136
+ - app/assets/config/effective_assets_manifest.js
136
137
  - app/assets/images/effective_assets/icon_close.png
137
138
  - app/assets/images/effective_assets/spinner.gif
138
139
  - app/assets/images/mime-types/excel.jpg
@@ -142,7 +143,7 @@ files:
142
143
  - app/assets/images/mime-types/video.png
143
144
  - app/assets/images/mime-types/word.jpg
144
145
  - app/assets/images/mime-types/zip.png
145
- - app/assets/javascripts/effective/snippets/effective_asset.js.coffee.erb
146
+ - app/assets/javascripts/effective/snippets/effective_asset.js.coffee
146
147
  - app/assets/javascripts/effective_assets.js
147
148
  - app/assets/javascripts/effective_assets/asset_box.js.coffee
148
149
  - app/assets/javascripts/effective_assets/asset_box_dialog.js.coffee
@@ -170,7 +171,7 @@ files:
170
171
  - app/models/effective/access_denied.rb
171
172
  - app/models/effective/asset.rb
172
173
  - app/models/effective/attachment.rb
173
- - app/models/effective/iframe_uploads.rb
174
+ - app/models/effective/iframe_upload.rb
174
175
  - app/models/effective/snippets/effective_asset.rb
175
176
  - app/models/inputs/asset_box.rb
176
177
  - app/models/inputs/asset_box_form_input.rb
@@ -193,7 +194,6 @@ files:
193
194
  - app/views/effective/assets/_video.html.erb
194
195
  - app/views/effective/assets/iframe.html.haml
195
196
  - app/views/effective/snippets/_effective_asset.html.haml
196
- - app/views/effective/style_guide/_effective_assets.html.haml
197
197
  - config/effective_assets.rb
198
198
  - config/routes.rb
199
199
  - db/migrate/01_create_effective_assets.rb.erb
@@ -207,7 +207,7 @@ homepage: https://github.com/code-and-effect/effective_assets
207
207
  licenses:
208
208
  - MIT
209
209
  metadata: {}
210
- post_install_message:
210
+ post_install_message:
211
211
  rdoc_options: []
212
212
  require_paths:
213
213
  - lib
@@ -222,9 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  requirements: []
225
- rubyforge_project:
226
- rubygems_version: 2.4.5.1
227
- signing_key:
225
+ rubygems_version: 3.1.2
226
+ signing_key:
228
227
  specification_version: 4
229
228
  summary: Upload images and files directly to AWS S3 with a custom form input then
230
229
  seamlessly organize and attach them to any ActiveRecord object.
@@ -1,27 +0,0 @@
1
- # This is a class used for the IFrame views
2
-
3
- module Effective
4
- class IframeUploads < ActiveRecord::Base
5
- acts_as_asset_box :uploads
6
-
7
- def initialize(items = nil)
8
- super()
9
- @column_types = {}
10
-
11
- add_to_asset_box(:uploads, items)
12
- end
13
-
14
- def self.columns
15
- @columns ||= []
16
- end
17
-
18
- def self.column_defaults
19
- {}
20
- end
21
-
22
- def self.has_attribute?(*args)
23
- false
24
- end
25
-
26
- end
27
- end
@@ -1,24 +0,0 @@
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)'