effective_assets 1.4.1 → 1.4.2
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/assets/javascripts/effective_assets/s3_uploader.js.coffee +1 -1
- data/app/models/concerns/acts_as_asset_box.rb +14 -0
- data/app/models/inputs/asset_box.rb +2 -1
- data/app/views/asset_box_input/_uploader.html.haml +2 -2
- data/lib/effective_assets/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0244911fcc10857aa7af03aa50d314dc06e717e
|
4
|
+
data.tar.gz: 353142e7ecefe07e87f816389c031a26ec40c3ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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{:
|
12
|
+
%input.asset-box-uploader-fileinput{type: 'file', name: 'file', id: uid, multiple: 'multiple', disabled: disabled}
|
13
13
|
- else
|
14
|
-
%input{:
|
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
|
|