No commit activity in last 3 years
No release in over 3 years
This gem embeddes the jQuery colorpicker in the Rails asset pipeline.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.2.8
 Project Readme

jQuery colorpicker for Rails

Gem Version Build Status Code Climate

This gem embeddes the jQuery colorpicker in the Rails asset pipeline.

Screenshot

See http://labs.abeautifulsite.net/jquery-minicolors/

Installation

Add to Gemfile and run bundle install:

# Gemfile
gem 'jquery-minicolors-rails'

Add to app/assets/javascripts/application.js:

//= require jquery # Not included
//= require jquery.minicolors

Add to app/assets/stylesheets/application.css:

/*
 *= require jquery.minicolors
 */

Usage

Just call minicolors() with any text-input selector:

# With default options:
$ -> $('input[type=text]').minicolors()

# With Bootstrap theme (Bootstrap-3 is supported):
$ -> $('input[type=text]').minicolors theme: 'bootstrap'

SimpleForm

Add to app/assets/javascripts/application.js:

//= require jquery # Not included
//= require jquery.minicolors
//= require jquery.minicolors.simple_form

See https://github.com/plataformatec/simple_form

<%# app/views/balloons/_form.html.erb %>

<%# Basic usage: %>
<%= simple_form_for @balloon do |f| %>
  <%= f.input :color, as: :minicolors %>
<% end %>

<%# With Bootstrap theme and swatch on the right: %>
<%= simple_form_for @balloon do |f| %>
  <%= f.input :color, as: :minicolors, input_html: {data: {
          minicolors: {theme: :bootstrap, position: :right}}} %>
<% end %>

Testing

bundle exec rspec

Since this gem uses a lot of different frameworks, anything is possible. So despite the specs are "green", please verify manually:

cd test_app
bundle
rails s
open http://localhost:3000/ # Assert everything looks & works good.
rm -rf tmp/cache
rm -rf public/assets
RAILS_ENV=production bundle exec rake assets:precompile
rails s -eproduction
open http://localhost:3000/ # Assert everything looks & works good.

Versioning

Gem Version

Gem has the same version as the vendored minicolors library (http://git.io/ZWaGNg) plus an extra minor version number.

MIT-License

Copyright 2012 Kostiantyn Kahanskyi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.