s3_file_field 1.0.1 → 1.0.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: 923bb699605e299a5d7298c3c09a67cd6bedb1ca
4
- data.tar.gz: 5de37bf2b0748615975d341b6cba27420d6e2070
3
+ metadata.gz: 5025bb801293eb807b8e58afa0dd99aa076c747f
4
+ data.tar.gz: c7abfb7835044983fac097b1a8d221b0a5e5b8c2
5
5
  SHA512:
6
- metadata.gz: 3e897f367434c4c86a4692b086a68fb969980d7e066c06ce1af09f46049ee4a8399329530408bce9069233909f6f70a5582e87628f3dbedb7f5f82eab0cd4471
7
- data.tar.gz: 1a6a764b2fd27983f3894404a251025312e95fb13af93cc1c370e4e668f8435e6febdd18b6f39b7b3906c8d08cb04e72214f72e9357257df69de99fc853cc219
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
- Stand-alone file field for S3 Direct Upload working with Rails nested forms.
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 's3_direct_upload'
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
- = form.s3_file_field :movie, :class => 'js-s3_file_field'
76
- .progress
77
- .meter{ :style => "width: 0%" }
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
- ActionView::Helpers::Tags::FileField.new(
19
- object_name, method, self,
20
- options.reverse_merge(uploader.field_options)
21
- ).render
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
@@ -1,3 +1,3 @@
1
1
  module S3FileField
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
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.1
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-12 00:00:00.000000000 Z
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.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