All Projects → picandocodigo → administrate-field-paperclip

picandocodigo / administrate-field-paperclip

Licence: MIT license
Paperclip field plugin for Administrate

Programming Languages

ruby
36898 projects - #4 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to administrate-field-paperclip

administrate-field-carrierwave
🌊 A plugin to upload and preview Carrierwave attachments in Administrate
Stars: ✭ 16 (+14.29%)
Mutual labels:  administrate
administrate-field-jsonb
A plugin to show and edit JSON objects within Administrate.
Stars: ✭ 38 (+171.43%)
Mutual labels:  administrate
PaperMC-Update
A simple CLI python script that automates checking, downloading, and installing PaperMC server updates.
Stars: ✭ 15 (+7.14%)
Mutual labels:  paperclip
file-handling
File Handling Helper
Stars: ✭ 14 (+0%)
Mutual labels:  paperclip
Questions
Web app inspired by Quora, allowing users ask question and get answers
Stars: ✭ 15 (+7.14%)
Mutual labels:  paperclip

Administrate::Field::Paperclip

A plugin to integrate Paperclip fields in Administrate.

Paperclip has been deprecated, so starting in version 0.0.6, this gem depends on 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 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:

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

Based on the Administrate::Field::Image template.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].