README.md in attachy-0.1.1 vs README.md in attachy-0.1.2
- old
+ new
@@ -81,35 +81,100 @@
format: jpg
public_id: default
version: 42
```
-## Showing
+## Transformations
-If you want just show your uploaded image, use:
+To know more about transformations, check the [Cloudinary Doc](http://cloudinary.com/documentation/image_transformations).
-```html
-<%= attachy_link :avatar, @object %>
+## Helpers
+
+### Attachy
+
```
+<%= f.attachy :avatar,
+ t: { width: 160, height: 160, crop: :fill },
+ tl: { width: 800, height: 600, crop: :scale },
+ button: { html: { text: 'Upload' } }
+%>
+```
-It will generate a link to your image with the image inside.
++ `t`: image transformations;
++ `tl`: linked image transformations;
++ `button.html`: button html attributes.
-## Transformation
+```
+<div class="attachy">
+ <ul class="attachy__content">
+ <li class="attachy__node">
+ <a class="attachy__link" href="">
+ <img src="">
+ </a>
-You can manipulate the image using the `t` attribute:
+ <span class="attachy__remove">×</span>
+ </li>
+ </ul>
+ <div class="attachy__button">
+ <span>...</span>
+
+ <input type="file" class="attachy__fileupload">
+
+ <input value="[]" type="hidden">
+ </div>
+</div>
```
-<%= f.attachy :avatar, t: { width: 160, height: 160, crop: :fill } %>
+
++ `attachy`: wrapper;
++ `attachy__content`: the file content;
++ `attachy__node`: each file of the content;
++ `attachy__link`: the link of some file;
++ `img`: the uploaded file;
++ `attachy__remove`: button to remove the image;
++ `attachy__button`: pseudo button to access the upload file button;
++ `span`: the label of the button;
++ `attachy__fileupload`: the upload file field;
++ `hidden`: the field that keeps hidden the files metadata as JSON.
+
+## Link
+
+It draws the link with the image inside:
+
```
+<%= attachy_link :avatar, @object
+ t: { width: 160, height: 160, crop: :fill },
+ tl: { width: 800, height: 600, crop: :scale },
+ html: { class: :added_custom }
+%>
+```
-To know more about transformations, check the [Cloudinary Doc](http://cloudinary.com/documentation/image_transformations).
++ `t`: image transformations;
++ `tl`: linked image transformations;
++ `html`: link html attributes.
-## HTML
+```
+<a class="attachy__link" href="">
+ <img src="">
+</a>
+```
-For HTML attributes, just use `html`:
+### Image
+It draws the link with the image inside:
+
```
-<%= f.attachy :avatar, html: { width: 160, height: 160, alt: 'Image' } %>
+<%= attachy_image :avatar, @object
+ t: { width: 160, height: 160, crop: :fill },
+ html: { alt: :me }
+%>
+```
+
++ `t`: image transformations;
++ `html`: link html attributes.
+
+```
+<img src="https://res.cloudinary.com/account/image/upload/secret/version/hash.format">
```
## Test
Before send pull request, check if specs is passing.