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

rails-jquery-tokeninput

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails-jquery-tokeninput

  • 0.2.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

rails-jquery-tokeninput Build Status

Integrating Tokeninput jQuery plugin version 1.6.1.

Installation

Add this line to your application's Gemfile:

gem 'rails-jquery-tokeninput'

And then execute:

$ bundle

Require jquery.tokeninput.js in your application.js:

//= require rails-jquery-tokeninput

Add the stylesheets you want to use in your application.css:

*= require token-input-facebook

Usage

To start using gem you just have to add data-attribute to your text input:

names = [{ id: 1, name: 'John' }, { id: 2, name: 'Mike' }]

f.text_field :names, 'data-tokeninput' => { collection: names }.to_json

Or if you are using Simple Form or Formtastic it may looks like:

countries = [{ name: 'Hong Kong', iso_code: 'HK' }, { name: 'Jamaica', iso_code: 'JM' }]
options = { theme: 'facebook', tokenValue: 'iso_code' }

f.input :countries, as: :string, input_html: {
  data: { tokeninput: { collection: countries, options: options } }
}

It will automatically pass input values to your controller like an array (works well with pg_array).

It also automatically pre populate existed items.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 03 Mar 2015

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