No commit activity in last 3 years
No release in over 3 years
Integrates Paperclip as a field for Administrate in Rails apps
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.2
 Project Readme

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.

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