Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/picandocodigo/administrate-field-paperclip
Paperclip field plugin for Administrate
https://github.com/picandocodigo/administrate-field-paperclip
administrate paperclip rails
Last synced: about 1 month ago
JSON representation
Paperclip field plugin for Administrate
- Host: GitHub
- URL: https://github.com/picandocodigo/administrate-field-paperclip
- Owner: picandocodigo
- License: mit
- Created: 2017-03-07T19:40:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-01-24T18:52:01.000Z (about 4 years ago)
- Last Synced: 2024-12-27T00:10:26.079Z (about 1 month ago)
- Topics: administrate, paperclip, rails
- Language: Ruby
- Homepage: https://rubygems.org/gems/administrate-field-paperclip
- Size: 31.3 KB
- Stars: 14
- Watchers: 3
- Forks: 13
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Administrate::Field::Paperclip
A plugin to integrate [Paperclip](https://github.com/thoughtbot/paperclip) fields in [Administrate](https://github.com/thoughtbot/administrate).
**[Paperclip has been deprecated](https://thoughtbot.com/blog/closing-the-trombone)**, so starting in version 0.0.6, this gem depends on [kt-paperclip](https://github.com/kreeti/kt-paperclip), an ongoing fork of Paperclip. If you're still using the deprecated version of Paperclip, version 0.0.5 should still work for you.
# Instructions
Add `administrate-field-paperclip` and `kt-paperclip` to your Gemfile:
```
gem 'administrate-field-paperclip'
gem 'kt-paperclip'
```Install:
```
$ bundle install
```## Usage
Follow the [instructions on Paperclip](https://github.com/kreeti/kt-paperclip#quick-start) to get started with your models and migrations. Once you've added the Paperclip attribute to your models, edit your Administrate dashboards. If you added 'avatar' to 'User', then you should:
```ruby
class UserDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = {
avatar: Field::Paperclip,
}
# ...
```Then add `:avatar` to `FORM_ATTRIBUTES`, `SHOW_PAGE_ATTRIBUTES` and (optionally) `COLLECTION_ATTRIBUTES`.
You can provide the field with options using `Field::Paperclip.with_options(options)`:
* `thumbnail_style` (defaults to `'thumbnail'`) to control what image style is used to display the image in collection views
* `big_style` (defaults to `'original'`) to control what image style is used to display the image on the show page.
* `url_only` (defaults to `false`) to show only a URL (as a link) instead of trying to display an image.## [Contributors](https://github.com/picandocodigo/administrate-field-paperclip/graphs/contributors)
* Klas Eskilson - https://github.com/klaseskilson
* Rich - https://github.com/pedantic-gitBased on the [Administrate::Field::Image](https://github.com/thoughtbot/administrate-field-image) template.