Skip to content
🌊 A plugin to upload and preview Carrierwave attachments in Administrate
Ruby HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app/views/fields/carrierwave
bin
lib/administrate/field
spec Remove `image_on_index` Apr 13, 2019
.gitignore
.rspec
.rubocop.yml
.ruby-version
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
Gemfile
Guardfile
LICENSE.md
README.md
Rakefile
administrate-field-carrierwave.gemspec

README.md

Administrate::Field::Carrierwave

Build Status Code Climate

A plugin to upload and preview Carrierwave attachments in Administrate.

Usage

Add it to your Gemfile:

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

Run:

$ bundle install

Add to your FooDashboard:

ATTRIBUTE_TYPES = {
  bar: Field::Carrierwave.with_options(
    image: :standard,
    multiple: true,
    remove: false,
    remote_url: false
  )
}.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.
  • 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.
  • remove (default: false): allow to remove previously uploaded files. ATTENTION 🚨 extend permitted_attributes by remove_FIELD
  • remote_url (default: false): allow uploading files from a remote location. ATTENTION 🚨 extend permitted_attributes by remote_FIELD_url

About

Administrate::Field::Carrierwave is maintained by Zooppa.

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

You can’t perform that action at this time.