Sha256: 81d67bdf391253e788e4bd31ea3822ed25a11618fbdf591300e56b74f8b04d56

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

# CreditCardTypeField

Credit card type field auto detected by the credit card number.

## Installation
Only support Rails 3.1+ with jQuery

Add this line to your application's Gemfile:

    gem 'credit_card_type_field'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install credit_card_type_field

Add to assets pipeline

application.js

    $ //= require credit_card_type_field

application.css

    $ *= require credit_card_type_field

## Tutorial

Support form_for and simple_form_for. Examples:

```ruby
  <%= form_for @credit_card do |f| %>
    <%= f.text_field :credit_card_no %>
    <%= f.credit_card_type_field :card_type %>
  <% end %>
```

Specify the credit card number name and supported credit card types:

```ruby
  <%= form_for @credit_card do |f| %>
    <%= f.text_field :card_no %>
    <%= f.credit_card_type_field :card_type, card_number_field_name: 'card_no', accept_types: %w(visa master) %>
  <% end %>
```

Done! CreditCardTypeField gem will add javascript keyup event listening to the credit card number field. It is able to detect what kind of the input 
credit card is according to the credit card number. At present, only visa master american_express diners_club are supported. 

## TODO
  add credit_card_type_tag
  
  add DEMO

## 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

## License

MIT

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
credit_card_type_field-1.5 README.md
credit_card_type_field-1.4 README.md
credit_card_type_field-1.3 README.md