Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

administrate-field-select

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

administrate-field-select

  • 2.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Administrate::Field::Select

Adds basic select/dropdown fields to ThoughtBot's Administrate

Gem Version Build Status

NOTE: Since v0.1.15, Administrate now supports its own Field::Select with a slightly different mechanic. So this has been renamed to Field::SelectBasic. Please update your Gemfiles (as below) and rename your calls to this field.

Installation

Add this line to your application's Gemfile:

gem 'administrate-field-select', '~> 2.0', require: 'administrate/field/select_basic'

And then execute:

$ bundle

Usage

In your dashboard's ATRRIBUTE_TYPES, use the type Field::SelectBasic with options:

ATTRIBUTE_TYPES = {
  my_field: Field::SelectBasic.with_options({
    choices: ['option_one', 'option_two', 'option_three']
  }),
  some_other_field: Field::String,
}

The options specified in choices will be passed as the choice to a Rails select tag.

Additional options that are available:

  • include_blank: If true or a string, includes a blank option in the dropdown (with the string as its text).
  • prettify: If true, passes all choices through titleize before displaying them (in all views). If a lambda, that lambda is used instead of titleize.
  • i18n: If true, passes all choices through i18n before displaying them (in all views).

If both prettify and i18n are specified then prettify takes precedence.

Todo

Some ideas for possible enhancements:

  1. Be more magic with enum types and reflect the choices

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fishpercolator/administrate-field-select. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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

FAQs

Package last updated on 27 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc