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 +4 -4
- data/app/assets/javascripts/activeadmin_addons/all.js.coffee +2 -1
- data/app/assets/javascripts/activeadmin_addons/color-picker.js +17 -0
- data/app/assets/stylesheets/activeadmin_addons/all.scss +5 -0
- data/app/inputs/color_picker_input.rb +45 -0
- data/lib/activeadmin_addons/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85197363b107bdb2d1170a7696ab0e2c6d0fd254
|
4
|
+
data.tar.gz: 097811968fc90e6aaac157f501f374eb3362f6e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
});
|
@@ -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
|
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.
|
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
|