Rails integration for Bootstrap Colorpicker, with simpel_form input.
Switch branches/tags
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.
lib
vendor/assets
.gitignore
CHANGELOG.md
Gemfile
LICENSE.txt
README.md
Rakefile
bootstrap_colorpicker_rails.gemspec

README.md

BootstrapColorpickerRails

Gem Version Code Climate Dependency Status

This gem is Rails integration for Bootstrap Colorpicker. It includes simple_form input for Colorpicker.

Bootstrap Colorpicker originally written by Stefan Petre (@eyecon) and maintained in Github by Javier Aguilar (@mjolnic) and the community.

Note: This gem doesn't include Bootstrap itself, it inludes only Bootstrap Colorpicker. You can get Bootstrap here

Installation

Add this line to your application's Gemfile:

gem 'bootstrap_colorpicker_rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bootstrap_colorpicker_rails

Usage

Add stylesheet file to app/assets/stylesheets/application.css.scss

@import "bootstrap-colorpicker";

Add javascript file to app/assets/javascripts/application.js

//= require bootstrap-colorpicker

Using directly

Just call colorpicker() with any selector.

<input class='colorpicker'>

<script type="text/javascript">
  $(document).ready(function(){
    $('.colorpicker').colorpicker();
  })
</script>

There are some options you can pass to colorpicker(). They are documented at http://mjolnic.github.io/bootstrap-colorpicker/

Using with simple_form

There is simple_form input which you can apply via as: :colorpicker option.

<%= f.input :color, as: :colorpicker %>

Note: For simple_form version < '3.1.0' use this gem version '0.1.1'

Contributing

  1. Fork it ( https://github.com/ShPakvel/bootstrap_colorpicker_rails/fork )
  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 a new Pull Request

License

This gem is licensed under the MIT License.
Bootstrap Colorpicker itself is licensed under the Apache License, Version 2.0.