activeadmin_addons 0.6.0 → 0.6.1

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: 85197363b107bdb2d1170a7696ab0e2c6d0fd254
4
- data.tar.gz: 097811968fc90e6aaac157f501f374eb3362f6e9
3
+ metadata.gz: 786d40bebae70cd402a84a76745d378ec5bf93bc
4
+ data.tar.gz: 7c87ef117c0b35a9b067bca847a51ba5d83bb571
5
5
  SHA512:
6
- metadata.gz: 50c8878a2696527d3863fc78565684217a7c58557ee87d77b5ba75d16d5ea777daf4a28e6700ff678897128424abe33813660849213e43e12f075f14c2ab358c
7
- data.tar.gz: 78ab25709eea387d63be4986cba6b2b660bd38cccd47b34a57d0b1c4cdaac960b16ffa0652b51bffda3928a28d1ca8dcb6c9282c533680c7ea0fa96afa986706
6
+ metadata.gz: 6956dccf95bd17affa65e06694018ad641a7e7524721b0be6fb1adcaaaa88d277b634a8528fe2869cf372f9de8c26bb6d40647cbcea70034335d528490be5ead
7
+ data.tar.gz: 2a4912e36b52806c739528df133237024e4203c13e11d2d7caa374bae714feb520477fcd9ffb88900594c8be9c5c26cd9fb603b12ee1a3c393c9075d3fadcee9
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Carlos Cabo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,172 @@
1
+ /**
2
+ * JQuery Palette Color Picker v1.01 by Carlos Cabo ( @putuko )
3
+ * https://github.com/carloscabo/jquery-palette-color-picker
4
+ */
5
+ (function($) {
6
+ // La magia aquí
7
+ 'use strict';
8
+
9
+ // Public core
10
+ $.paletteColorPicker = function( el, options ) {
11
+ var
12
+ ns = 'palette-color-picker', // Base attr / class
13
+ $el = $(el),
14
+ plugin = this,
15
+ timer = null,
16
+ current_value = $el.val(),
17
+ target = $el.attr('name'),
18
+ $button = $('<div>')
19
+ .addClass(ns+'-button')
20
+ .attr('data-target', target),
21
+ $bubble = $('<div>')
22
+ .addClass(ns+'-bubble'),
23
+ // Final settings will be stored here
24
+ settings = {},
25
+ // Default settings
26
+ defaults = {
27
+ custom_class: null,
28
+ colors: null,
29
+ position: 'upside', // upside | downside
30
+ insert: 'before', // default
31
+ clear_btn: 'first', // default
32
+ timeout: 2000 // default
33
+ };
34
+
35
+ // Init
36
+ plugin.init = function() {
37
+ // Extand settings with user options
38
+ plugin.settings = $.extend({}, defaults, options);
39
+
40
+ // If color were not passed as options get them from data-palette attribute
41
+ if (plugin.settings.colors === null) {
42
+ plugin.settings.colors = $el.data('palette');
43
+ }
44
+
45
+ // If color is array of string, convert to obj
46
+ if (typeof plugin.settings.colors[0] === 'string') {
47
+ plugin.settings.colors = $.map(plugin.settings.colors, function(el, idx) {
48
+ var b = {}; b[el] = el; return b;
49
+ });
50
+ }
51
+
52
+ // Capitalize position
53
+ plugin.settings.insert = plugin.settings.insert.charAt(0).toUpperCase() + plugin.settings.insert.slice(1);
54
+
55
+ // Add custom_class
56
+ if (plugin.settings.custom_class) {
57
+ $bubble.addClass(plugin.settings.custom_class);
58
+ }
59
+
60
+ // Create color swatches
61
+ $.each( plugin.settings.colors, function( idx, obj ) {
62
+ var
63
+ key = Object.keys( obj )[0],
64
+ col = obj[key],
65
+ $sw = $('<span>').addClass('swatch')
66
+ .attr({
67
+ 'title': key,
68
+ 'data-color': col,
69
+ 'data-name': key
70
+ }).css('background-color', col);
71
+
72
+
73
+ // console.log(key + '===' + current_value + ' - > '+(key === current_value)+' - t -'+(typeof key)+' '+(typeof current_value));
74
+ if ( key === current_value ) {
75
+ $sw.addClass('active');
76
+ $button.css('background', col);
77
+ }
78
+
79
+ $sw.appendTo( $bubble );
80
+ });
81
+
82
+ // Create clear button
83
+ var
84
+ $clear_btn = $('<span>').addClass('swatch clear').attr('title', 'Clear selection');
85
+ if (plugin.settings.clear_btn === 'last') {
86
+ $clear_btn.addClass('last').appendTo( $bubble );
87
+ } else {
88
+ $clear_btn.prependTo( $bubble );
89
+ }
90
+
91
+ // Public
92
+ plugin.destroy = function() {
93
+ $button.remove();
94
+ $.removeData( $el[0] );
95
+ };
96
+
97
+ // Events
98
+ // Simple click
99
+ $button.append( $bubble ).on('click', function(){
100
+ var $b = $( this );
101
+ $b.toggleClass('active').find('.'+ns+'-bubble').fadeToggle();
102
+ if ($b.hasClass('active')) {
103
+ clearTimeout(plugin.timer);
104
+ plugin.timer = setTimeout(function(){
105
+ $b.trigger('pcp.fadeout');
106
+ }, plugin.settings.timeout);
107
+ }
108
+ })
109
+ // Fade timer
110
+ .on('pcp.fadeout', function() {
111
+ $( this ).removeClass('active').find('.'+ns+'-bubble').fadeOut();
112
+ })
113
+ // Enter bubble
114
+ .on('mouseenter', '.'+ns+'-bubble', function() {
115
+ clearTimeout(plugin.timer);
116
+ })
117
+ // Leave bubble
118
+ .on('mouseleave', '.'+ns+'-bubble', function() {
119
+ plugin.timer = setTimeout(function(){
120
+ $button.trigger('pcp.fadeout');
121
+ }, plugin.settings.timeout);
122
+ })
123
+ // Click on swatches
124
+ .on('click', 'span.swatch', function(e){
125
+ var
126
+ col = $( this ).attr('data-color'),
127
+ name = $( this ).attr('data-name'),
128
+ // Select all button in document with same data target to keep them synconized
129
+ $button = $('.'+ns+'-button[data-target="' + $( this ).closest( '.'+ns+'-button' ).attr('data-target') + '"]'),
130
+ $bubble = $( this ).closest( '.'+ns+'-bubble' );
131
+
132
+ // console.log('.'+ns+'-button [data-target="' + $( this ).closest( '.'+ns+'-button' ).attr('data-target') + '"]');
133
+ $bubble.find('.active').removeClass('active');
134
+
135
+ // Set background on color
136
+ // User clicked in the clear swatch
137
+ if ( $(e.target).is('.clear') ) {
138
+ $button.removeAttr('style');
139
+ col = '';
140
+ } else {
141
+ $(this).addClass('active');
142
+ $button.css('background', col);
143
+ }
144
+ $( '[name="'+$button.attr('data-target')+'"]' ).val( name );
145
+ })['insert'+plugin.settings.insert]( $el );
146
+
147
+ // Upside / downside, default is upside
148
+ if ( plugin.settings.position === 'downside' || ($el.offset().top) + 20 < $bubble.outerHeight() ) {
149
+ $bubble.addClass('downside');
150
+ }
151
+
152
+ };
153
+
154
+ // Start
155
+ plugin.init();
156
+ };
157
+
158
+ // add the plugin to the jQuery.fn object
159
+ $.fn.paletteColorPicker = function(options) {
160
+ return this.each(function() {
161
+ if (typeof $(this).data('paletteColorPickerPlugin') === 'undefined') {
162
+ $(this).data('paletteColorPickerPlugin', new $.paletteColorPicker(this, options));
163
+ }
164
+ });
165
+ };
166
+
167
+ })(jQuery);
168
+
169
+ // Sample usage
170
+ // $(function() {
171
+ // $('[data-palette-color-picker]').paletteColorPicker();
172
+ // });
@@ -0,0 +1,145 @@
1
+ $cpfp-width: 220px;
2
+ $cpfp-button-size: 28px;
3
+ $cpfp-border: #bbb;
4
+ $cpfp-background: #fff;
5
+
6
+ // Button
7
+ .palette-color-picker-button {
8
+ position: relative;
9
+ display: inline-block;
10
+ width: $cpfp-button-size;
11
+ height: $cpfp-button-size;
12
+ margin-right: 8px;
13
+ background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="#f5c86c" d="M2 2h8v8H2z"/><path fill="#f56c6c" d="M12 2h8v8h-8z"/><path fill="#f46ac6" d="M22 2h8v8h-8z"/><path fill="#c3f167" d="M2 12h8v8H2z"/><path fill="#f3f3f3" d="M12 12h8v8h-8z"/><path fill="#c76cf5" d="M22 12h8v8h-8z"/><path fill="#69e369" d="M2 22h8v8H2z"/><path fill="#6bc6f4" d="M12 22h8v8h-8z"/><path fill="#6b6bf5" d="M22 22h8v8h-8z"/><path d="M9 3v6H3V3h6m1-1H2v8h8V2zm9 1v6h-6V3h6m1-1h-8v8h8V2zm9 1v6h-6V3h6m1-1h-8v8h8V2zM9 13v6H3v-6h6m1-1H2v8h8v-8zm9 1v6h-6v-6h6m1-1h-8v8h8v-8zm9 1v6h-6v-6h6m1-1h-8v8h8v-8zM9 23v6H3v-6h6m1-1H2v8h8v-8zm9 1v6h-6v-6h6m1-1h-8v8h8v-8zm9 1v6h-6v-6h6m1-1h-8v8h8v-8z" opacity=".25"/></svg>') center center no-repeat;
14
+ background-size: cover;
15
+ /*background: url(palette-color-picker-icon.svg) center center no-repeat;*/
16
+ cursor: pointer;
17
+
18
+ outline: 1px solid $cpfp-border;
19
+ border: 2px solid #fff;
20
+ }
21
+
22
+ // Bubble
23
+ .palette-color-picker-bubble {
24
+ display: none;
25
+ margin: 12px 0;
26
+ position: absolute;
27
+ bottom: 100%;
28
+ width: $cpfp-width;
29
+ padding: 10px 8px 8px 8px;
30
+ border: 1px solid $cpfp-border;
31
+ border-radius: 3px;
32
+ background-color: #fff;
33
+
34
+ // Arrow bottom
35
+ &:after,
36
+ &:before {
37
+ top: 100%;
38
+ left: 14px;
39
+ border: solid transparent;
40
+ content: ' ';
41
+ height: 0;
42
+ width: 0;
43
+ position: absolute;
44
+ pointer-events: none;
45
+ }
46
+ &:after {
47
+ border-color: transparent;
48
+ border-top-color: $cpfp-background;
49
+ border-width: 8px;
50
+ margin-left: -8px;
51
+ }
52
+ &:before {
53
+ border-color: transparent;
54
+ border-top-color: $cpfp-border;
55
+ border-width: 9px;
56
+ margin-left: -9px;
57
+ }
58
+
59
+ // Open below
60
+ &.downside {
61
+ bottom: auto;
62
+ top: 100%;
63
+
64
+ // Arow on top
65
+ &:after, &:before {
66
+ top: auto;
67
+ bottom: 100%;
68
+ }
69
+ &:after {
70
+ border-top-color: transparent;
71
+ border-bottom-color: $cpfp-background;
72
+ }
73
+ &:before {
74
+ border-top-color: transparent;
75
+ border-bottom-color: $cpfp-border;
76
+ }
77
+ }
78
+
79
+ .swatch {
80
+ position: relative;
81
+ display: inline-block;
82
+ font: 0/0 a;
83
+ width: 12.66%;
84
+ padding-top: 11.00%;
85
+ margin: 1% 2%;
86
+ outline: 1px solid $cpfp-border;
87
+ border: 2px solid #fff;
88
+ border-radius: 3px;
89
+ cursor: pointer;
90
+ overflow: hidden;
91
+
92
+
93
+ &.active {
94
+ outline-color: #000;
95
+
96
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
97
+ -moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
98
+ box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
99
+ }
100
+
101
+ &.clear {
102
+ background-color: #fff;
103
+ &:before {
104
+ position: absolute;
105
+ content: '';
106
+ display: block;
107
+ top: -1px;
108
+ left: 0;
109
+ width: 100px;
110
+ height: 2px;
111
+ background-color: #e00;
112
+
113
+ transform-origin: 0 0;
114
+ transform: rotate(45deg);
115
+ }
116
+ }
117
+ }
118
+
119
+ // x2 width swatches
120
+ &.double {
121
+ .swatch {
122
+ width: 29.30%;
123
+ padding-top: 11.00%;
124
+ margin: 1% 2%;
125
+ &.clear {
126
+ &:before {
127
+ transform: rotate(22.5deg);
128
+ }
129
+ }
130
+ }
131
+ }
132
+
133
+ // full width swatches
134
+ &.wide {
135
+ .swatch {
136
+ width: 96.2%;
137
+ padding-top: 11.00%;
138
+ margin: 1% 2%;
139
+ &.clear {
140
+ width: 12.66%;
141
+ }
142
+ }
143
+ }
144
+
145
+ }
@@ -1,4 +1,4 @@
1
- //= require palette-color-picker
1
+ //= require ../../external/palette-color-picker/palette-color-picker
2
2
  //= require_self
3
3
 
4
4
  $(function() {
@@ -1,5 +1,5 @@
1
1
  @import "select2";
2
- @import "palette-color-picker";
2
+ @import "../../external/palette-color-picker/palette-color-picker";
3
3
 
4
4
  .filter_range_select {
5
5
  input[type=number] {
@@ -1,3 +1,3 @@
1
1
  module ActiveadminAddons
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_addons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platanus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-27 00:00:00.000000000 Z
11
+ date: 2016-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -243,6 +243,9 @@ extra_rdoc_files: []
243
243
  files:
244
244
  - MIT-LICENSE
245
245
  - Rakefile
246
+ - app/assets/external/palette-color-picker/LICENSE
247
+ - app/assets/external/palette-color-picker/palette-color-picker.js
248
+ - app/assets/external/palette-color-picker/palette-color-picker.scss
246
249
  - app/assets/images/fileicons/file_extension_3gp.png
247
250
  - app/assets/images/fileicons/file_extension_7z.png
248
251
  - app/assets/images/fileicons/file_extension_ace.png