The project is in a healthy, maintained state
CSV field plugin for Administrate
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0

Runtime

~> 3.0
>= 6.0
 Project Readme

Administrate::Field::CSV

A custom Administrate field to present Strings with CSV content in a table format on you show views. This field uses truncated text for index views, and a text area for form views.

Compatibility

  • Administrate >= 1.0
  • Rails >= 6.0 (including Rails 8)
  • Sprockets or Propshaft — the field ships plain CSS, so no SCSS compiler is required

Installation

Add this line to your application's Gemfile:

gem 'administrate-field-csv'

And then execute:

$ bundle install

Add the below to your app/assets/config/manifest.js if your administrate configuration is using the asset pipeline.

//= link administrate-field-csv/application.css

Usage

ATTRIBUTE_TYPES = {
    # ...
    csv_text: Field::CSV.with_options(
      headers: true,
      col_sep: ',',
      row_sep: "\r\n",
      quote_char: '"',
      return_headers: false,
      truncate: 50,
      blank_sign: "--"
    )
}

All possible options for the field are shown above along with their default values. Refer to the ruby CSV documentation for details around the possible values for headers, col_sep, row_sep, quote_char and return_headers.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in administrate-field-csv.gemspec, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jameswilliamiii/administrate-field-csv.

License

The gem is available as open source under the terms of the MIT License.