anaconda 0.12.0 → 0.12.1
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/README.markdown +6 -0
- data/app/assets/javascripts/anaconda_uploader.js.coffee +43 -8
- data/lib/anaconda/form_builder_helpers.rb +2 -1
- data/lib/anaconda/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b215602192966e3b701912a7388182b37487bb93
|
4
|
+
data.tar.gz: c74e123f394996b4c3fddf73779c34cb02ad156c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a314d5936a6c90df4cc3bdc69baa42d2a80a27472bc384a19a0c8425790e9e327495bbbe0de9889bc1611994e7d46e6f8517be0d2fbf7d810d2bbac6765e1feb
|
7
|
+
data.tar.gz: d43e7f37a75056d1fc11e7c0e153337924d8faacabdb68b74b88c696d4ff616d465c22fbacf0d5ed6b06c6f0e7ddb0a73fc04da089650ee5399097a50a3cce27
|
data/README.markdown
CHANGED
@@ -179,6 +179,12 @@ We highly recommend the `figaro` gem [https://github.com/laserlemon/figaro](http
|
|
179
179
|
`asset_download_url` will return a signed S3 URL with content-disposition set to attachment so the file will be downloaded instead of opened in the browser.
|
180
180
|
|
181
181
|
## Changelog
|
182
|
+
* 0.12.1
|
183
|
+
* Make progress bar go to 100% on upload complete
|
184
|
+
* Properly store ACL on file upload (`asset_stored_privately`)
|
185
|
+
* Properly store `original_filename` on upload
|
186
|
+
* Fix bug when dragging and dropping onto the file select button
|
187
|
+
|
182
188
|
* 0.12.0
|
183
189
|
* Delete files from S3 when a new one us uploaded, or the record is deleted.
|
184
190
|
* Add options to disable deleting files from S3 when a new one is uploaded (`remove_previous_s3_files_on_change` and `remove_previous_s3_files_on_destroy`). These default to `true`
|
@@ -10,6 +10,7 @@ class @AnacondaUploadManager
|
|
10
10
|
@upload_automatically = false
|
11
11
|
@submit_automatically = false
|
12
12
|
@setup_form_submit_handler()
|
13
|
+
@bind_dropzone_effects()
|
13
14
|
self = this
|
14
15
|
$(document).on "page:fetch", ->
|
15
16
|
DLog "page:fetch"
|
@@ -70,6 +71,37 @@ class @AnacondaUploadManager
|
|
70
71
|
@form.find("input[type='submit']").prop( "disabled", true );
|
71
72
|
enable_submit_button: ->
|
72
73
|
@form.find("input[type='submit']").prop( "disabled", false );
|
74
|
+
|
75
|
+
bind_dropzone_effects: ->
|
76
|
+
$(document).bind 'drop dragover', (e) ->
|
77
|
+
e.preventDefault()
|
78
|
+
|
79
|
+
$(document).bind 'dragover', (e) ->
|
80
|
+
dropZone = $('.anaconda_dropzone')
|
81
|
+
timeout = window.dropZoneTimeout
|
82
|
+
if !timeout
|
83
|
+
dropZone.addClass('in');
|
84
|
+
else
|
85
|
+
clearTimeout(timeout);
|
86
|
+
|
87
|
+
found = false
|
88
|
+
node = e.target
|
89
|
+
|
90
|
+
while node != null
|
91
|
+
if node in dropZone
|
92
|
+
found = true
|
93
|
+
break
|
94
|
+
node = node.parentNode;
|
95
|
+
|
96
|
+
if found
|
97
|
+
dropZone.addClass('hover')
|
98
|
+
else
|
99
|
+
dropZone.removeClass('hover')
|
100
|
+
|
101
|
+
window.dropZoneTimeout = setTimeout ->
|
102
|
+
window.dropZoneTimeout = null
|
103
|
+
dropZone.removeClass('in hover')
|
104
|
+
, 100
|
73
105
|
|
74
106
|
class @AnacondaUploadField
|
75
107
|
constructor: (options = {}) ->
|
@@ -92,7 +124,7 @@ class @AnacondaUploadField
|
|
92
124
|
@file = null
|
93
125
|
@file_data = null
|
94
126
|
@media_types = $(@element_id).data('media-types')
|
95
|
-
|
127
|
+
@acl = $(@element_id).data('form-data').acl
|
96
128
|
|
97
129
|
@base_key = options.base_key ? ""
|
98
130
|
@key = options.key ? "#{@base_key}/${filename}"
|
@@ -118,7 +150,7 @@ class @AnacondaUploadField
|
|
118
150
|
setup_fileupload: ->
|
119
151
|
self = this
|
120
152
|
$( @element_id ).fileupload
|
121
|
-
|
153
|
+
dropZone: $( @element_id ).parent(".anaconda_dropzone"),
|
122
154
|
add: (e, data) ->
|
123
155
|
DLog data
|
124
156
|
self.file_selected data
|
@@ -129,6 +161,7 @@ class @AnacondaUploadField
|
|
129
161
|
self.update_progress_to(progress)
|
130
162
|
|
131
163
|
done: (e, data) ->
|
164
|
+
self.update_progress_to(100)
|
132
165
|
self.file_completed_upload data
|
133
166
|
|
134
167
|
fail: (e, data) ->
|
@@ -145,9 +178,6 @@ class @AnacondaUploadField
|
|
145
178
|
DLog("data.jqXHR:")
|
146
179
|
DLog(data.jqXHR )
|
147
180
|
|
148
|
-
$(document).bind 'drop dragover', (e) ->
|
149
|
-
e.preventDefault()
|
150
|
-
|
151
181
|
upload: ->
|
152
182
|
return if @upload_completed
|
153
183
|
if @file != null && @file_data != null
|
@@ -178,6 +208,12 @@ class @AnacondaUploadField
|
|
178
208
|
|
179
209
|
reset: ->
|
180
210
|
@upload_details_container.html ''
|
211
|
+
|
212
|
+
stored_privately: ->
|
213
|
+
if @acl == "private"
|
214
|
+
true
|
215
|
+
else
|
216
|
+
false
|
181
217
|
|
182
218
|
file_selected: (data) ->
|
183
219
|
DLog data
|
@@ -237,16 +273,15 @@ class @AnacondaUploadField
|
|
237
273
|
# })
|
238
274
|
|
239
275
|
# DLog "will now fill form #{@upload_complete_form_to_fill}"
|
240
|
-
|
241
|
-
DLog "#{@resource}_#{@attribute}_file_path"
|
242
276
|
hyphenated_resource = @resource.replace(/_/g, "-")
|
243
277
|
hyphenated_attribute = @attribute.replace(/_/g, "-")
|
244
|
-
DLog "input[data-#{hyphenated_resource}-#{hyphenated_attribute}-file-path]"
|
245
278
|
|
246
279
|
$( @element_id ).siblings( "input[data-#{hyphenated_resource}-#{hyphenated_attribute}-file-path]" ).val( @key.replace("${filename}", @file.name) )
|
247
280
|
$( @element_id ).siblings( "input[data-#{hyphenated_resource}-#{hyphenated_attribute}-filename]" ).val( @file.name )
|
248
281
|
$( @element_id ).siblings( "input[data-#{hyphenated_resource}-#{hyphenated_attribute}-size]" ).val( @file.size )
|
249
282
|
$( @element_id ).siblings( "input[data-#{hyphenated_resource}-#{hyphenated_attribute}-type]" ).val( @file.type )
|
283
|
+
$( @element_id ).siblings( "input[data-#{hyphenated_resource}-#{hyphenated_attribute}-original-filename]" ).val( @file.name )
|
284
|
+
$( @element_id ).siblings( "input[data-#{hyphenated_resource}-#{hyphenated_attribute}-stored-privately]" ).val( @stored_privately() )
|
250
285
|
|
251
286
|
@upload_in_progress = false;
|
252
287
|
@upload_completed = true;
|
@@ -24,8 +24,9 @@ module Anaconda
|
|
24
24
|
end
|
25
25
|
|
26
26
|
uploader = S3Uploader.new(options)
|
27
|
-
|
27
|
+
output += "<div class='anaconda_dropzone'>"
|
28
28
|
output += self.input_field "file", name: "file", id: element_id, as: :file, data: {url: uploader.url, form_data: uploader.fields.to_json, media_types: Anaconda.js_file_types}
|
29
|
+
output += "</div>"
|
29
30
|
end
|
30
31
|
|
31
32
|
output += self.hidden_field "#{anaconda_field_name}_filename".to_sym, data: {"#{instance.class.to_s.underscore}_#{anaconda_field_name}_filename" => true}
|
data/lib/anaconda/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anaconda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben McFadden
|
@@ -15,28 +15,28 @@ dependencies:
|
|
15
15
|
name: jquery-fileupload-rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 0.4.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 0.4.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: javascript_dlog-rails
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 1.0.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 1.0.1
|
42
42
|
description: Dead simple file uploading to S3
|
@@ -46,8 +46,8 @@ extensions: []
|
|
46
46
|
extra_rdoc_files:
|
47
47
|
- LICENSE.txt
|
48
48
|
files:
|
49
|
-
- .document
|
50
|
-
- .gitignore
|
49
|
+
- ".document"
|
50
|
+
- ".gitignore"
|
51
51
|
- Gemfile
|
52
52
|
- LICENSE.txt
|
53
53
|
- README.markdown
|
@@ -83,17 +83,17 @@ require_paths:
|
|
83
83
|
- lib
|
84
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - ">="
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.2.
|
96
|
+
rubygems_version: 2.2.2
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Dead simple file uploading to S3
|