Giter VIP home page Giter VIP logo

administrate-field-carrierwave's Introduction

Administrate::Field::Carrierwave

Code Climate

A plugin to upload and preview Carrierwave attachments in Administrate.

Usage

Add it to your Gemfile:

gem 'administrate-field-carrierwave', '~> 0.2.0'

Run:

$ bundle install

Add to your FooDashboard:

ATTRIBUTE_TYPES = {
  bar: Field::Carrierwave.with_options(
    image: :standard,
    multiple: true,
    image_on_index: true
  )
}.freeze

To handle multiple asset uploads, the attribute must point to an empty array in a hash:

# If multiple: true
def permitted_attributes
  super - [:bar] + [{ bar: [] }]
end

Options

  • image (default: nil): a version that will be displayed in an <img> element.
  • image_on_index (default: false): whether or not to show the image itself on the index list view. The default behavior (when false) is to display a "View" link that opens the image in a new tab/window when clicked.
  • multiple (default: false): allows uploading of multiple files. ATTENTION 🚨: requires CarrierWave’s master branch. Uploaded files will replace the current ones – if present – and not add to them.

About

Administrate::Field::Carrierwave is maintained by z.productions.

See also the list of contributors who participated in this project.

administrate-field-carrierwave's People

Contributors

michelegera avatar nerfologist avatar mnrk avatar jondkinney avatar

Watchers

 avatar James Cloos avatar

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.