s3_file_field 1.0.1 → 1.0.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/README.md +16 -5
- data/lib/s3_file_field/form_helper.rb +11 -4
- data/lib/s3_file_field/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5025bb801293eb807b8e58afa0dd99aa076c747f
|
4
|
+
data.tar.gz: c7abfb7835044983fac097b1a8d221b0a5e5b8c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 246098d838fe86dda91a936f8c63b610be1c4026f87b50cf7578ac23de9860961125aade187f1f44b5019017b1b6382437c57e19a891df60cd1fc99dcbfd743d
|
7
|
+
data.tar.gz: bb51f9c1fe656774f3d594e5c7d18dcd4ce5f68ea237aecd58fca5da1b379d121156e1afb1c4b9dfbb990855dfb3f1503a2aa185eced6ed6601b2572f6610480
|
data/README.md
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
# S3 File Field
|
2
2
|
|
3
|
-
|
3
|
+
jQuery File Upload extension for direct uploading to Amazon S3 using CORS
|
4
4
|
|
5
5
|
Works as an extension of [jQuery File Upload](http://blueimp.github.io/jQuery-File-Upload/) JavaScript plugin and supports IE 7-10.
|
6
6
|
|
7
|
+
Note: Since 1.0.2 gem works with both Rails 3 and Rails 4.
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add this line to your application's Gemfile:
|
10
12
|
|
11
13
|
```ruby
|
12
|
-
gem '
|
14
|
+
gem 's3_file_field'
|
13
15
|
```
|
14
16
|
|
15
17
|
Then add a new initalizer with your AWS credentials:
|
@@ -72,12 +74,21 @@ Add the following js to your asset pipeline:
|
|
72
74
|
|
73
75
|
Create a new view that uses the form helper `s3_uploader_form`:
|
74
76
|
```haml
|
75
|
-
=
|
76
|
-
.
|
77
|
-
.
|
77
|
+
= form_for :user do |form|
|
78
|
+
= form.s3_file_field :scrapbook, :class => 'js-s3_file_field'
|
79
|
+
.progress
|
80
|
+
.meter{ :style => "width: 0%" }
|
78
81
|
```
|
79
82
|
|
80
83
|
Then in your application.js.coffee something like:
|
84
|
+
|
85
|
+
```coffeescript
|
86
|
+
jQuery.ready ->
|
87
|
+
$('.js-s3_file_field').S3FileField()
|
88
|
+
```
|
89
|
+
|
90
|
+
or
|
91
|
+
|
81
92
|
```coffeescript
|
82
93
|
ready = ->
|
83
94
|
$(".js-s3_file_field").each ->
|
@@ -15,10 +15,17 @@ module S3FileField
|
|
15
15
|
|
16
16
|
def s3_file_field(object_name, method, options = {})
|
17
17
|
uploader = S3Uploader.new(options)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
options = options.reverse_merge(uploader.field_options)
|
19
|
+
if ::Rails.version.to_i >= 4
|
20
|
+
ActionView::Helpers::Tags::FileField.new(
|
21
|
+
object_name, method, self, options
|
22
|
+
).render
|
23
|
+
else
|
24
|
+
ActionView::Helpers::InstanceTag.new(
|
25
|
+
object_name, method, self,
|
26
|
+
options.reverse_merge(uploader.field_options).delete(:object)
|
27
|
+
).to_input_field_tag("file", options.update({:size => nil}))
|
28
|
+
end
|
22
29
|
end
|
23
30
|
|
24
31
|
class S3Uploader
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3_file_field
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Stankiewicz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.0.
|
132
|
+
rubygems_version: 2.0.3
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: jQuery File Upload extension for direct uploading to Amazon S3 using CORS
|