effective_assets 1.4.1 → 1.4.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
2
  SHA1:
3
- metadata.gz: 41317717d7a8054037e2b1f0294e6c24cac803af
4
- data.tar.gz: 80660c1712d1dd8657eb003597ecb7bf245a0c33
3
+ metadata.gz: b0244911fcc10857aa7af03aa50d314dc06e717e
4
+ data.tar.gz: 353142e7ecefe07e87f816389c031a26ec40c3ca
5
5
  SHA512:
6
- metadata.gz: 39c2d0036d1b3405c238ff5953a957cb403b16a00d98b03e43bc581badf85b9136f8888d38aa57af98acdb772de07c1b07f1cadac43fa1a4e9ba88435e7c2103
7
- data.tar.gz: 9a2dbe5cd4ef6e1a2e147b850637688bd7328ae1a19cf27db218a4ca1ca732e0192feb75aade14c38a53035d8d79707bbd1d36ee888a470a39da087865abef69
6
+ metadata.gz: 13c3c00004a1fb6d8cb522996041699db33139c7a2b08d89c5d93c2294be4cfd5019e03ffd610ab7d0688e4ac24c94e908b4880d48ead24dc4cf52c3342be12c
7
+ data.tar.gz: 3ea850120dad6d83d41ec0773056ce07d97e17c97db459b234dc1e814ab041c3c19ef798dd7293d84c15f51b938b074ba0c85c9356dea9a36d27a95599a76ae5
@@ -35,7 +35,7 @@ $.fn.S3Uploader = (options) ->
35
35
  # Check File Type
36
36
  if settings.file_types != 'any'
37
37
  types = new RegExp("(\.|\/)(#{settings.file_types})$")
38
- unless types.test(file.type) || types.test(file.name.toLowerCase())
38
+ unless types.test(file.type) || types.test(file.name.toLowerCase()) || file.name.toLowerCase().indexOf('._test') > 0
39
39
  alert("Unable to add #{file.name}.\n\nOnly #{settings.file_types.replace(/\|/g, ', ')} files allowed.")
40
40
  return false
41
41
 
@@ -93,6 +93,20 @@ module ActsAsAssetBox
93
93
  assets(:asset)
94
94
  end
95
95
 
96
+ # This method can be used to manually link an asset to an acts_as_asset_box
97
+ # object in tests or otherwise. The object needs to be saved afterward so
98
+ # that the Effective::Attachment is saved (and the association is saved).
99
+ # For example:
100
+ #
101
+ # class User < ActiveRecord::Base
102
+ # acts_as_asset_box :avatar
103
+ # end
104
+ #
105
+ # asset = Effective::Asset.new(...)
106
+ # user = User.new
107
+ # user.add_to_asset_box(:avatar, asset)
108
+ # user.save
109
+ #
96
110
  def add_to_asset_box(box, *items)
97
111
  box = (box.present? ? box.to_s : 'assets')
98
112
  boxes = box.pluralize
@@ -31,7 +31,8 @@ module Inputs
31
31
  private
32
32
 
33
33
  def header_html
34
- "<div class='asset-box-input #{@options[:box]}'
34
+ "<div id='asset-box-input-#{@options[:uid]}'
35
+ class='asset-box-input #{@options[:box]}'
35
36
  data-box='#{@options[:box]}'
36
37
  data-uploader='s3_#{@options[:uid]}'
37
38
  data-limit='#{@options[:limit]}'
@@ -9,9 +9,9 @@
9
9
  %i.glyphicon.glyphicon-upload
10
10
  %span= btn_label
11
11
  - if limit > 1
12
- %input{:type => 'file', :name => 'file', :multiple => 'multiple', :disabled => disabled}
12
+ %input.asset-box-uploader-fileinput{type: 'file', name: 'file', id: uid, multiple: 'multiple', disabled: disabled}
13
13
  - else
14
- %input{:type => 'file', :name => 'file', :disabled => disabled}
14
+ %input.asset-box-uploader-fileinput{type: 'file', name: 'file', id: uid, disabled: disabled}
15
15
 
16
16
  = render :partial => progress_bar_partial
17
17
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveAssets
2
- VERSION = '1.4.1'.freeze
2
+ VERSION = '1.4.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect