No commit activity in last 3 years
No release in over 3 years
Rails integration for Bootstrap Colorpicker, with simpel_form input.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

>= 3.0
 Project Readme

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.