effective_assets 1.6.9 → 1.7.0

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: cd04206c6534741d975b580c7a23d971474cee16
4
- data.tar.gz: 947246d4dd2da35c57ce999c542abaed303bd7e0
3
+ metadata.gz: 9e5b0e16ffa38f1ce220cc208ff42d4418f13d25
4
+ data.tar.gz: bc514be07640f7796280e5c33e7381c82bf87d99
5
5
  SHA512:
6
- metadata.gz: 5322431aee4fb9b0bf81d50502917d184dcabd7e04c9e2abec3e6f25a423e3ea1ff61d35abbe376c4dccef27dc4c9d61d554c38735dee5c33709b8ace980e912
7
- data.tar.gz: ad6b87af1bf6a93d20cd180a106fdb5c8e97add42f99752a613e2425a86ca0174ca214316474537d0496d9f381624380a50e264802f3f28f1eb8bd75e9355dc1
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 = Effective::Asset.where(id: effective_iframe_uploads)
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
- skip_before_filter :verify_authenticity_token
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(:text => {:id => @asset.id, :s3_key => asset_s3_key(@asset)}.to_json, :status => 200)
24
+ render(:body => {:id => @asset.id, :s3_key => asset_s3_key(@asset)}.to_json, :status => 200)
20
25
  rescue => e
21
- render(:text => e.message, :status => 500)
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 :text => '', :status => :unprocessable_entity
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 :text => '', :status => 200
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 => "Effective::Attachment", :dependent => :delete_all
38
- has_many :assets, :through => :attachments, :class_name => "Effective::Asset"
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(&:position).find { |attachment| attachment.box == boxes }.try(:asset)
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!(&:position)
137
+ attachments.to_a.sort_by! { |attachment| attachment.position }
138
138
 
139
139
  true
140
140
  end
@@ -15,5 +15,13 @@ module Effective
15
15
  @columns ||= []
16
16
  end
17
17
 
18
+ def self.column_defaults
19
+ {}
20
+ end
21
+
22
+ def self.has_attribute?(*args)
23
+ false
24
+ end
25
+
18
26
  end
19
27
  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)'
@@ -1,3 +1,3 @@
1
1
  module EffectiveAssets
2
- VERSION = '1.6.9'.freeze
2
+ VERSION = '1.7.0'.freeze
3
3
  end
@@ -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 = TestAssetUploader # Must extend from EffectiveAssetsUploader
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.6.9
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-02 00:00:00.000000000 Z
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