activeadmin_addons 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd92629876e0e6126a5c8c3817e9461f3081457d
4
- data.tar.gz: 39ee31af6e9e4a2481398e51ee282737dc2cf6cc
3
+ metadata.gz: 85197363b107bdb2d1170a7696ab0e2c6d0fd254
4
+ data.tar.gz: 097811968fc90e6aaac157f501f374eb3362f6e9
5
5
  SHA512:
6
- metadata.gz: 5c249c52f18839a3a872d8b0c84939538d3e41d860b81af87c4575e61f9432bce5c7d30e32f281ef9a7b8ae0e4dec6d2bd9c9f182e2118d1279f3028857bc563
7
- data.tar.gz: 970af68b279c1ef42a316d32b68aad79a87d9a0f40a1a2d1ece6d7996555c4d6ca522c973f82ff8c420db26242342fff41265ecb5a9e92784f1e463a80007c28
6
+ metadata.gz: 50c8878a2696527d3863fc78565684217a7c58557ee87d77b5ba75d16d5ea777daf4a28e6700ff678897128424abe33813660849213e43e12f075f14c2ab358c
7
+ data.tar.gz: 78ab25709eea387d63be4986cba6b2b660bd38cccd47b34a57d0b1c4cdaac960b16ffa0652b51bffda3928a28d1ca8dcb6c9282c533680c7ea0fa96afa986706
@@ -1 +1,2 @@
1
- #= require ./select2
1
+ #= require ./select2
2
+ #= require ./color-picker
@@ -0,0 +1,17 @@
1
+ //= require palette-color-picker
2
+ //= require_self
3
+
4
+ $(function() {
5
+
6
+ setupColorPicker();
7
+
8
+ $(document).on('has_many_add:after', setupColorPicker);
9
+
10
+ function setupColorPicker() {
11
+ $('.color-picker').each(function(i, el) {
12
+ $(el).paletteColorPicker({
13
+ clear_btn: 'last'
14
+ });
15
+ });
16
+ }
17
+ });
@@ -1,4 +1,5 @@
1
1
  @import "select2";
2
+ @import "palette-color-picker";
2
3
 
3
4
  .filter_range_select {
4
5
  input[type=number] {
@@ -21,3 +22,7 @@
21
22
  }
22
23
  }
23
24
  }
25
+
26
+ .palette-color-picker-bubble {
27
+ z-index: 10;
28
+ }
@@ -0,0 +1,45 @@
1
+ class ColorPickerInput < Formtastic::Inputs::StringInput
2
+ DEFAULT_PALETTE = [
3
+ "#000000",
4
+ "#333333",
5
+ "#663300",
6
+ "#CC0000",
7
+ "#CC3300",
8
+ "#FFCC00",
9
+ "#009900",
10
+ "#006666",
11
+ "#0066FF",
12
+ "#0000CC",
13
+ "#663399",
14
+ "#CC0099",
15
+ "#FF9999",
16
+ "#FF9966",
17
+ "#FFFF99",
18
+ "#99FF99",
19
+ "#66FFCC",
20
+ "#99FFFF",
21
+ "#66CCFF",
22
+ "#9999FF",
23
+ "#FF99FF",
24
+ "#FFCCCC",
25
+ "#FFCC99",
26
+ "#FFFFFF",
27
+ ]
28
+
29
+ def to_html
30
+ input_wrapping do
31
+ [
32
+ label_html,
33
+ builder.hidden_field(method, input_html_options),
34
+ ].join("\n").html_safe
35
+ end
36
+ end
37
+
38
+ def input_html_options
39
+ opts = {}
40
+ opts["class"] = 'color-picker'
41
+ opts["data-palette"] = (@options[:palette] || DEFAULT_PALETTE).to_json
42
+ opts["value"] = @object.public_send(method)
43
+ super.merge(opts)
44
+ end
45
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveadminAddons
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_addons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platanus
@@ -347,8 +347,10 @@ files:
347
347
  - app/assets/images/fileicons/file_extension_xpi.png
348
348
  - app/assets/images/fileicons/file_extension_zip.png
349
349
  - app/assets/javascripts/activeadmin_addons/all.js.coffee
350
+ - app/assets/javascripts/activeadmin_addons/color-picker.js
350
351
  - app/assets/javascripts/activeadmin_addons/select2.js
351
352
  - app/assets/stylesheets/activeadmin_addons/all.scss
353
+ - app/inputs/color_picker_input.rb
352
354
  - app/inputs/nested_select_input.rb
353
355
  - app/inputs/range_select_input.rb
354
356
  - app/inputs/search_select_input.rb