BootstrapColorpickerRails
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
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
- Fork it ( https://github.com/ShPakvel/bootstrap_colorpicker_rails/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - 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.