README.md in simple_images-0.0.1 vs README.md in simple_images-0.0.2
- old
+ new
@@ -1,7 +1,9 @@
# Simple Images
+[](https://travis-ci.org/kainage/simple_images)
+
Add simple one-click image uploading to active record models.
**Requires ruby >= 1.9.3**
**Requires rails >= 4.0.0**
@@ -103,20 +105,39 @@
An image must be associated to an active record model. If you want all images to be
availible to all things just pick an arbitrary object that you are not going to
destroy (such as first user) and associate all images with that record.
-Include the javascript file in your application.js manifest:
+Include the javascript file in your application.js manifest. If you want the basic,
+page reloading functionality:
```
-//= require simple_images
+//= require simple_images/uploader
```
+Or the AJAX uploader using jquery.fileupload:
+
+```
+//= require simple_images/ajax_uploader
+```
+
+If you are using the AJAX uploader, you MUST have a file in ```views/simple_images/create.js.erb```
+and ```views/simple_images/update.js.erb``` with what to do after the form is submitted.
+An example of create:
+
+```
+<% if @simple_image.new_record? %>
+ alert("Failed to upload simple image: <%= j @simple_image.errors.full_messages.join(', ').html_safe %>");
+<% else %>
+ $("#simple_images").append("<%= j render(@simple_image) %>");
+<% end %>
+```
+
Include the stylesheet in your application.css manifest:
```
/*
- *= require simple_images
+ *= require simple_images/uploader
*/
```
You can omit the stylesheet if you want to style your own upload button from scratch