GithubHelp home page GithubHelp logo

mark100net / administrate-field-paperclip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from picandocodigo/administrate-field-paperclip

0.0 2.0 0.0 22 KB

Paperclip field plugin for Administrate

Home Page: https://rubygems.org/gems/administrate-field-paperclip

License: MIT License

Ruby 93.61% HTML 6.39%

administrate-field-paperclip's Introduction

Administrate::Field::Paperclip

A plugin to integrate Paperclip fields in Administrate.

Instructions

Add administrate-field-paperclip and paperclip to your Gemfile:

gem 'administrate-field-paperclip'
gem '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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.