Skip to content

Commit e325434

Browse files
committed
Update README.md
1 parent 6ed7f4a commit e325434

File tree

1 file changed

+51
-9
lines changed

1 file changed

+51
-9
lines changed

README.md

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
jquery-fileupload-rails is a library that integrates jQuery File Upload for Rails 3.1 Asset Pipeline (Rails 3.2 supported).
66

7-
## Plugin versions
7+
## Plugin versions (7-march-2014)
88

9-
* jQuery File Upload User Interface Plugin 6.11
10-
* jQuery File Upload Plugin 5.19.3
11-
* jQuery UI Widget 1.9.1+amd
9+
* jQuery File Upload User Interface Plugin 8.7.1
10+
* jQuery File Upload Plugin 5.40.1
11+
* jQuery UI Widget 1.10.4+amd
1212

1313
## Installing Gem
1414

15-
gem "jquery-fileupload-rails"
15+
gem "jquery-fileupload-rails", :git => 'git://github.com/Johaned/jquery-fileupload-rails'
1616

1717
## Using the javascripts
1818

@@ -40,21 +40,63 @@ If you only need the basic files, just add the code below to your application.js
4040

4141
The basic setup only includes the following files:
4242

43-
//= require jquery-fileupload/vendor/jquery.ui.widget
44-
//= require jquery-fileupload/jquery.iframe-transport
45-
//= require jquery-fileupload/jquery.fileupload
43+
//=require jquery-fileupload/vendor/jquery.ui.widget
44+
//=require jquery-fileupload/jquery.iframe-transport
45+
//=require jquery-fileupload/jquery.fileupload
46+
//=require jquery-fileupload/locale
4647

4748
## Using the stylesheet
4849

4950
Require the stylesheet file to app/assets/stylesheets/application.css
5051

5152
*= require jquery.fileupload-ui
53+
54+
## Example of Use (Rails 3.1 - RailsCast 381 Based)
55+
56+
#### Painting Index Page
57+
<h1>Painting Gallery</h1>
58+
59+
<div id="paintings">
60+
<%= render @paintings %>
61+
</div>
62+
<div class="clear"></div>
63+
64+
<%= form_for Painting.new do |f| %>
65+
<%= f.label :image, "Upload paintings:" %>
66+
<%= f.file_field :image, name: "painting[image]" %>
67+
<% end %>
68+
69+
<div id="progress">
70+
<div class="bar" style="width: 0%;"></div>
71+
</div>
72+
73+
#### paintings.js.coffee
74+
75+
$ ->
76+
if($.browser.msie && !$.support.xhrFileUpload)# works fine with jquery 1.8.3, in jquery 1.10 it does not work
77+
force_iframe = true
78+
data_type = 'iframe'
79+
else
80+
force_iframe = false
81+
data_type = 'script'
82+
$('#new_painting').fileupload
83+
dataType: data_type
84+
forceIframeTransport: force_iframe
85+
add: (e, data) ->
86+
data.context = $("<p/>").text("Uploading...").appendTo(document.body)
87+
data.submit()
88+
done: (e, data) ->
89+
data.context.text "Upload finished."
90+
progressall: (e, data) ->
91+
progress = parseInt(data.loaded / data.total * 100, 10)
92+
$("#progress .bar").css "width", progress + "%"
93+
return
5294

5395
## Thanks
5496
Thanks to [Sebastian Tschan](https://github.com/blueimp) for writing an awesome file upload plugin.
5597

5698
## License
57-
Copyright (c) 2012 Tors Dalid
99+
Copyright (c) 2014 Tors Dalid
58100

59101
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
60102
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

0 commit comments

Comments
 (0)