jquery-minicolors-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NTUyYzRiNjM3ZWYwM2JjNDI5ODgzOWM1YWI2OTJhNWVkNmU5NmUwNA==
5
+ data.tar.gz: !binary |-
6
+ Y2UyZTI5YzA4OGVjYjg3OTA3YTNjN2I1ZTAxOGYzZTg4ZTJkMDZhMw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MzgzYmE3M2M0ZjdmYjZiZDBkOTE4MGRkZDZmOWE3ZjUxNzMxZjM1Y2Q5NzI0
10
+ ZTc3ZWJhYTZiYmY1N2RhNGZmMTUwMDA0ZThmMmQwOWQ5YTU5ODI5MDkwNmM5
11
+ Yzc3ZjhjZDE0ZjQ2MGViYTI3Zjc1MDRlMDgzMjk1NWQ4NWM4YTU=
12
+ data.tar.gz: !binary |-
13
+ NDdkMTI3ZjIxOGJiMWY4MWExZjhlYWNkYTZlZjA0MjgwMGM1ODkzZmVjN2E2
14
+ OWJhZDI0MjYwOWY0M2Y4OTRhN2I3ZWNiNDAzMjBmYjNjNDk1MGZjNTliMzQ5
15
+ MzY5MGRhODEwNDM4ZmUyYzZiZThmOWM5NWIyOTFhMjQyNmZlNzg=
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This gem embedes the jQuery colorpicker plugin miniColors in the Rails asset pipeline.
4
4
 
5
+ ![Screenshot](https://raw.github.com/kostia/jquery-minicolors-rails/master/screenshot.png)
6
+
5
7
  See https://github.com/claviska/jquery-miniColors
6
8
 
7
9
  ## Installation
@@ -33,8 +35,13 @@ Add to `app/assets/stylesheets/application.css`:
33
35
  Just call `miniColors()` with any text-input selector:
34
36
 
35
37
  ```coffeescript
38
+ // With default options:
39
+ jQuery ->
40
+ $('input[type=text]').minicolors();
41
+
42
+ // With Bootstrap theme:
36
43
  jQuery ->
37
- $('input[type=text]').miniColors();
44
+ $('input[type=text]').minicolors({theme: 'bootstrap'});
38
45
  ```
39
46
 
40
47
  # With SimpleForm
@@ -44,9 +51,16 @@ See https://github.com/plataformatec/simple_form
44
51
  ```erb
45
52
  <%# app/views/balloons/_form.html.erb %>
46
53
 
54
+ <%# Basic usage: %>
47
55
  <%= simple_form_for @balloon do |f| %>
48
56
  <%= f.input :color, as: :minicolors %>
49
57
  <% end %>
58
+
59
+ <%# With Bootstrap theme and swatch on the right: %>
60
+ <%= simple_form_for @balloon do |f| %>
61
+ <%= f.input :color, as: :minicolors, input_html: {data: {
62
+ minicolors: {theme: :bootstrap, swatchPosition: :right}}} %>
63
+ <% end %>
50
64
  ```
51
65
 
52
66
  Add to `app/assets/javascripts/application.js`:
@@ -3,7 +3,7 @@ if defined? SimpleForm
3
3
  def input_html_options
4
4
  options = super
5
5
  options[:data] ||= {}
6
- options[:data].merge! editor: 'minicolors'
6
+ options[:data][:minicolors] ||= {}
7
7
  options
8
8
  end
9
9
 
@@ -1,3 +1,3 @@
1
1
  module JqueryMinicolorsRails
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -0,0 +1,6 @@
1
+ $(function() {
2
+ $('[data-minicolors]').each(function(i, elem) {
3
+ var input = $(this);
4
+ input.minicolors(input.data('minicolors'));
5
+ });
6
+ });