active_frontend 14.0.48 → 14.0.49

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: f119847a356317c97f0c198cc10ad33889c43467
4
- data.tar.gz: a6c0eaaf3d2d47abad0e905e0793d9fcc7b00bc1
3
+ metadata.gz: f51f3c438a087fe494899e67fb5300312c0005b4
4
+ data.tar.gz: 2fef5bfc75ead00d10d039e955626731fe7c5af2
5
5
  SHA512:
6
- metadata.gz: 6757dd125d0dd66abd41582d141d0dce20bcbdf2d2712687435b4bf0017f723192516d974564849ceb581726b4818c6cbb4a74eb67206a9deb7005a820e46541
7
- data.tar.gz: a6cb9b414d0a21f4be53b5d8b0b501a7183a963afbc2f094d8d71b9ac6a6b184d31ce38b1d1c2322b3ba409155a6eaa03b7ab0467d0ebc8aeea8806fda8b262a
6
+ metadata.gz: 134777e68db196faeb3e1374eacebde29d5a8ad2b3b90264ca39ab60e54932f5706ebba8727f2928a620baeef99fbfffd1a3b11a1438ad495274830b3b162cce
7
+ data.tar.gz: 9d3237b831d1c0248c90a900d9c3d6afbb5f24805b68004c2c726a2a6df31c87935cdb424e0b4cd8dc17557983862c7e5d34653b6816cdd4ac93be1ba5ff109f
@@ -1,3 +1,3 @@
1
1
  module ActiveFrontend
2
- VERSION = '14.0.48'.freeze
2
+ VERSION = '14.0.49'.freeze
3
3
  end
@@ -23,6 +23,7 @@
23
23
  //= require base/_button
24
24
  //= require base/_dropdown
25
25
  //= require base/_hoverdown
26
+ //= require base/_choicepicker
26
27
  //= require base/_colorpicker
27
28
  //= require base/_datepicker
28
29
  //= require base/_filepicker
@@ -40,6 +40,7 @@
40
40
  @import 'components/tooltip';
41
41
  @import 'components/popover';
42
42
  @import 'components/dropmenu';
43
+ @import 'components/choicepicker';
43
44
  @import 'components/colorpicker';
44
45
  @import 'components/datepicker';
45
46
  @import 'components/timepicker';
@@ -23,6 +23,7 @@
23
23
  //= require base/_button
24
24
  //= require base/_dropdown
25
25
  //= require base/_hoverdown
26
+ //= require base/_choicepicker
26
27
  //= require base/_colorpicker
27
28
  //= require base/_datepicker
28
29
  //= require base/_filepicker
@@ -0,0 +1,242 @@
1
+ +function ($) {
2
+ 'use strict';
3
+
4
+ // CHOICEPICKER PUBLIC CLASS DEFINITION
5
+ // ====================================
6
+
7
+ var Choicepicker = function (element, options) {
8
+ this.$element = $(element);
9
+ this.settings = {
10
+ options: this.$element.data('options'),
11
+ type: this.$element.data('type')
12
+ };
13
+ this.options = $.extend({}, Choicepicker.DEFAULTS, this.settings, options);
14
+
15
+ this.$selector = 'bsChoicepicker-label-' + this.randomNumber() + '-';
16
+ this.$widget = $(this.initWidget()).on('click', $.proxy(this.clickWidget, this));
17
+
18
+ this.init();
19
+ };
20
+
21
+ if (!$.fn.dropdown) throw new Error('Choicepicker requires dropdown.js');
22
+
23
+ Choicepicker.VERSION = '1.0.0';
24
+ Choicepicker.DEFAULTS = {
25
+ callback: function (option) {},
26
+ item: '<li></li>',
27
+ menu: '<ul class="choicepicker dropmenu caret"><span></span></ul>',
28
+ optionClass: 'form-align-vertical',
29
+ options: [],
30
+ text: {
31
+ all: 'All',
32
+ none: 'None',
33
+ optionless: 'No options available'
34
+ },
35
+ type: 'checkbox'
36
+ };
37
+
38
+ Choicepicker.prototype.constructor = Choicepicker;
39
+
40
+ Choicepicker.prototype.init = function () {
41
+ this.setWidget();
42
+ this.setVal();
43
+
44
+ this.$element.on({
45
+ 'focus.bs.choicepicker': $.proxy(this.showWidget, this),
46
+ 'click.bs.choicepicker': $.proxy(this.showWidget, this),
47
+ 'blur.bs.choicepicker': $.proxy(this.setVal, this)
48
+ });
49
+ };
50
+
51
+ Choicepicker.prototype.clickWidget = function (e) {
52
+ e.stopPropagation();
53
+
54
+ this.setVal();
55
+ };
56
+
57
+ Choicepicker.prototype.initWidget = function () {
58
+ var _self = this;
59
+ var menu = $(this.options.menu);
60
+
61
+ $.each(this.options.options, function (index, hash) {
62
+ var item = $(_self.options.item);
63
+
64
+ item.append(_self.optionTemplate(hash))
65
+ .append(_self.labelTemplate(hash).text(hash.label));
66
+
67
+ menu.find('span').append(item);
68
+ });
69
+
70
+ return menu;
71
+ };
72
+
73
+ Choicepicker.prototype.setWidget = function () {
74
+ this.$container = $('<span>')
75
+ .addClass('btn-group dropdown bsChoicepicker')
76
+ .css({
77
+ height: 0,
78
+ position: 'absolute',
79
+ width: 0
80
+ });
81
+
82
+ try {
83
+ this.$container.append(this.$widget);
84
+ this.$element.after(this.$container);
85
+ } catch(e) {
86
+ // Do nothing
87
+ }
88
+ };
89
+
90
+ Choicepicker.prototype.showWidget = function () {
91
+ this.$container.addClass('open');
92
+
93
+ var _self = this;
94
+ $(document).on('mousedown.bs.choicepicker, touchend.bs.choicepicker', function (e) {
95
+ if (!(_self.$element.parent().find(e.target).length ||
96
+ _self.$widget.is(e.target) ||
97
+ _self.$widget.find(e.target).length)) {
98
+ _self.hideWidget();
99
+ }
100
+ });
101
+ };
102
+
103
+ Choicepicker.prototype.hideWidget = function () {
104
+ this.$container.removeClass('open');
105
+ };
106
+
107
+ Choicepicker.prototype.type = function () {
108
+ var type = this.options.type;
109
+
110
+ if (type !== 'checkbox' && type !== 'radio') {
111
+ type = 'checkbox';
112
+ }
113
+
114
+ return type;
115
+ };
116
+
117
+ Choicepicker.prototype.selector = function (hash) {
118
+ var selector = this.$selector + hash.selector;
119
+
120
+ return selector;
121
+ };
122
+
123
+ Choicepicker.prototype.labelTemplate = function (hash) {
124
+ var selector = this.selector(hash);
125
+
126
+ return $('<label for="' + selector + '">');
127
+ };
128
+
129
+ Choicepicker.prototype.optionTemplate = function (hash) {
130
+ var type = this.type();
131
+ var selector = this.selector(hash);
132
+
133
+ var label = this.labelTemplate(hash);
134
+ label.append('<i class="icon-checkmark"></i>');
135
+
136
+ var checkbox = $('<input type="' + type +'" value="' + hash.value + '" name="' + hash.name + '" id="' + selector + '">');
137
+ checkbox.prop('checked', hash.checked);
138
+
139
+ var container = $('<div class="form-' + type + ' ' + this.options.optionClass + '">');
140
+ container.append(checkbox);
141
+ container.append(label);
142
+
143
+ return container;
144
+ };
145
+
146
+ Choicepicker.prototype.setVal = function () {
147
+ var label = this.setSelectionsLabel();
148
+
149
+ if (label == '[object Object]') return;
150
+
151
+ this.$element.val(label);
152
+ this.options.callback(label);
153
+ };
154
+
155
+ Choicepicker.prototype.randomNumber = function () {
156
+ return Math.floor((Math.random() * 100000) + 1);
157
+ };
158
+
159
+ Choicepicker.prototype.selectionLabel = function (label, count) {
160
+ count = count - 1;
161
+
162
+ if (count === 0) return label;
163
+
164
+ return label + ' (+' + count + ')';
165
+ };
166
+
167
+ Choicepicker.prototype.setSelectionsLabel = function () {
168
+ var _self = this;
169
+ var total = Object.keys(this.options.options).length;
170
+ var count = 0;
171
+ var label = '';
172
+
173
+ if (total === 0) return this.options.text.optionless;
174
+
175
+ $.each(this.options.options, function (index, hash) {
176
+ if (hash.checked === undefined) {
177
+ hash.checked = false;
178
+ } else {
179
+ var selector = $('#' + _self.selector(hash));
180
+
181
+ if (selector) {
182
+ hash.checked = selector.prop('checked');
183
+ }
184
+ }
185
+
186
+ if (hash.checked) {
187
+ count++;
188
+
189
+ if (label === '') {
190
+ label = hash.label;
191
+ }
192
+ }
193
+ });
194
+
195
+ if (count === total) return this.options.text.all;
196
+ if (count === 0) return this.options.text.none;
197
+
198
+ return this.selectionLabel(label, count);
199
+ };
200
+
201
+ // CHOICEPICKER PLUGIN DEFINITION
202
+ // ==============================
203
+
204
+ function Plugin(option) {
205
+ return this.each(function () {
206
+ var $this = $(this);
207
+ var data = $this.data('bs.choicepicker');
208
+ var options = typeof option === 'object' && option;
209
+
210
+ if (!data) $this.data('bs.choicepicker', (data = new Choicepicker(this, options)));
211
+ if (typeof option === 'string') data[option]();
212
+ });
213
+ }
214
+
215
+ var old = $.fn.choicepicker;
216
+
217
+ $.fn.choicepicker = Plugin;
218
+ $.fn.choicepicker.Constructor = Choicepicker;
219
+
220
+ // CHOICEPICKER NO CONFLICT
221
+ // ========================
222
+
223
+ $.fn.choicepicker.noConflict = function () {
224
+ $.fn.choicepicker = old;
225
+ return this;
226
+ };
227
+
228
+ // CHOICEPICKER DATA-API
229
+ // =====================
230
+
231
+ $(document)
232
+ .on('ready.bs.choicepicker.data-api', function () {
233
+ var $this = $(this).find('[data-toggle="choicepicker"]');
234
+ if ($this.data('choicepicker')) return;
235
+ Plugin.call($this, $this.data());
236
+ }).on('focus.bs.choicepicker.data-api click.bs.choicepicker.data-api', function (e) {
237
+ var $this = $(this);
238
+ if ($this.data('choicepicker')) return;
239
+ Plugin.call($this, $this.data());
240
+ });
241
+
242
+ }(jQuery);
@@ -40,6 +40,7 @@
40
40
  @import 'components/tooltip';
41
41
  @import 'components/popover';
42
42
  @import 'components/dropmenu';
43
+ @import 'components/choicepicker';
43
44
  @import 'components/colorpicker';
44
45
  @import 'components/datepicker';
45
46
  @import 'components/timepicker';
@@ -69,6 +69,7 @@ textarea {
69
69
  @include text-fill-color(color(gray));
70
70
  background: color(light-haze);
71
71
  color: color(gray);
72
+ font-weight: text-weight(normal) !important;
72
73
  }
73
74
 
74
75
  &.dark {
@@ -0,0 +1,31 @@
1
+ // Table of Contents
2
+ // ==================================================
3
+ // Choicepicker
4
+
5
+ // Choicepicker
6
+ // ==================================================
7
+ .choicepicker {
8
+ span {
9
+ display: block;
10
+ max-height: 230px;
11
+ overflow-x: auto;
12
+ }
13
+
14
+ li {
15
+ border-bottom: 1px solid;
16
+ border-bottom-color: inherit;
17
+ clear: both;
18
+ display: block;
19
+ font-weight: inherit;
20
+ line-height: 1;
21
+ padding: 16px 20px 14px;
22
+ margin: 0;
23
+
24
+ &:last-child { border-bottom: 0; }
25
+
26
+ > label {
27
+ font-weight: text-weight(normal);
28
+ margin: 0 0 0 10px;
29
+ }
30
+ }
31
+ }
@@ -2,6 +2,7 @@
2
2
  // ==================================================
3
3
  // Datepicker
4
4
 
5
+ // scss-lint:disable ImportantRule
5
6
  // scss-lint:disable NestingDepth
6
7
  // scss-lint:disable SelectorDepth
7
8
 
@@ -44,9 +45,10 @@
44
45
  &.old,
45
46
  &.new { color: color(gray); }
46
47
  &.disabled {
47
- background: color(transparent);
48
- color: color(gray);
49
- cursor: not-allowed;
48
+ background: color(transparent) !important;
49
+ color: dark-color(dark-haze) !important;
50
+ cursor: not-allowed !important;
51
+ text-decoration: line-through;
50
52
  }
51
53
 
52
54
  span {
@@ -70,9 +72,10 @@
70
72
  color: color(white);
71
73
  }
72
74
  &.disabled {
73
- background: color(transparent);
74
- color: color(gray);
75
- cursor: not-allowed;
75
+ background: color(transparent) !important;
76
+ color: dark-color(dark-haze) !important;
77
+ cursor: not-allowed !important;
78
+ text-decoration: line-through;
76
79
  }
77
80
  }
78
81
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.0.48
4
+ version: 14.0.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-28 00:00:00.000000000 Z
11
+ date: 2016-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -220,6 +220,7 @@ files:
220
220
  - vendor/assets/javascripts/base/_animation.js
221
221
  - vendor/assets/javascripts/base/_button.js
222
222
  - vendor/assets/javascripts/base/_carousel.js
223
+ - vendor/assets/javascripts/base/_choicepicker.js
223
224
  - vendor/assets/javascripts/base/_collapse.js
224
225
  - vendor/assets/javascripts/base/_colorpicker.js
225
226
  - vendor/assets/javascripts/base/_datepicker.js
@@ -271,6 +272,7 @@ files:
271
272
  - vendor/assets/stylesheets/components/_card.scss
272
273
  - vendor/assets/stylesheets/components/_carousel.scss
273
274
  - vendor/assets/stylesheets/components/_chart.scss
275
+ - vendor/assets/stylesheets/components/_choicepicker.scss
274
276
  - vendor/assets/stylesheets/components/_collapse.scss
275
277
  - vendor/assets/stylesheets/components/_colorpicker.scss
276
278
  - vendor/assets/stylesheets/components/_datepicker.scss