forked from platanus/activeadmin_addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(images-instructions): re name instructions and include shrine ex…
…plication
- Loading branch information
1 parent
14eb6f6
commit 90ab956
Showing
2 changed files
with
53 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Images Integration | ||
|
||
## Paperclip | ||
|
||
### Image Row | ||
|
||
```ruby | ||
show do | ||
attributes_table do | ||
image_row :photo | ||
end | ||
end | ||
``` | ||
|
||
<img src="./images/paperclip-image-row.png" height="400" /> | ||
|
||
### Image Column | ||
|
||
```ruby | ||
index do | ||
image_column :photo, style: :thumb | ||
end | ||
``` | ||
|
||
<img src="./images/paperclip-image-column.png" height="400" /> | ||
|
||
> You can pass `style` attribute matching paperclip's style definition | ||
## Shrine | ||
|
||
### Image Row | ||
|
||
The Shrine implementation receives an optional `image_options` which is then used as the options for the [`image_tag`](https://apidock.com/rails/ActionView/Helpers/AssetTagHelper/image_tag) method. | ||
```ruby | ||
show do | ||
attributes_table do | ||
image_row :photo, image_options: { width: 400 } | ||
end | ||
end | ||
``` | ||
|
||
<img src="./images/paperclip-image-row.png" height="400" /> | ||
|
||
### Image Column | ||
|
||
To use the Shrine [derivatives](https://shrinerb.com/docs/plugins/derivatives) you can use the `style` option with the name of the derivative like the example below. In this case you would need to have a derivative created with the `'jpg_small'` name. | ||
```ruby | ||
index do | ||
image_column :photo, style: :jpg_small | ||
end | ||
``` | ||
|
||
<img src="./images/paperclip-image-column.png" height="400" /> |
This file was deleted.
Oops, something went wrong.