active_frontend 14.0.78 → 14.0.79

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: 8544cdc4dd9cc5170713bdc8a9b71496dd3f3c3f
4
- data.tar.gz: abfa494a58da43ac00463ee56f343e72c7f1e3e2
3
+ metadata.gz: de8a5f38c474a6680953620fc55a1ae331d04b94
4
+ data.tar.gz: 9a59c2c42213cc8c132e1a7b084c7a1360aa9490
5
5
  SHA512:
6
- metadata.gz: 97b1e809ca7ca91ddbd68f55a26e9a0468e501419db04ccbedb267e09482809c9969b960364c8bd7e0cf450f84d69d62e4880f7bc332ccd42125e79303dd1951
7
- data.tar.gz: 3b6401d294cd809e31166de7bcca33443615d1427fd1c2c5715d053374049a040cd18870c350b257d78a3d331434f5477eded164b65eead9f6e3b894f011ac0c
6
+ metadata.gz: 24a65f0425927e9fb0c9adcbc3eabd44744a2c77ffe12e412ab9965ae89135887bb298b70952bf4d8900f2007ad9ba7753a96f4a30cfb6bc7240d328c646707e
7
+ data.tar.gz: 272d7b5d4a2db8a836d67df7adf78dfa25fbe5165aff9c2e1ae96f12451456ac709a9902afaacfb62c60afbd150f959fedd03b05cab04666185c4876832c568d
@@ -1,3 +1,3 @@
1
1
  module ActiveFrontend
2
- VERSION = '14.0.78'.freeze
2
+ VERSION = '14.0.79'.freeze
3
3
  end
@@ -27,6 +27,7 @@
27
27
  //= require base/_colorpicker
28
28
  //= require base/_datepicker
29
29
  //= require base/_filepicker
30
+ //= require base/_selectpicker
30
31
  //= require base/_timepicker
31
32
  //= require base/_typeahead
32
33
  //= require base/_timeago
@@ -43,6 +43,7 @@
43
43
  @import 'components/choicepicker';
44
44
  @import 'components/colorpicker';
45
45
  @import 'components/datepicker';
46
+ @import 'components/selectpicker';
46
47
  @import 'components/timepicker';
47
48
  @import 'components/typeahead';
48
49
  @import 'components/ad';
@@ -27,6 +27,7 @@
27
27
  //= require base/_colorpicker
28
28
  //= require base/_datepicker
29
29
  //= require base/_filepicker
30
+ //= require base/_selectpicker
30
31
  //= require base/_timepicker
31
32
  //= require base/_typeahead
32
33
  //= require base/_timeago
@@ -67,7 +67,7 @@
67
67
  }
68
68
  }
69
69
 
70
- _self.options.onVisibleItemsCallback(count);
70
+ _self.options.onVisibleItemsCallback(visible);
71
71
 
72
72
  return false;
73
73
  });
@@ -0,0 +1,242 @@
1
+ +function ($) {
2
+ 'use strict';
3
+
4
+ // SELECTPICKER PUBLIC CLASS DEFINITION
5
+ // ====================================
6
+
7
+ var Selectpicker = function (element, options) {
8
+ this.$element = $(element);
9
+ this.settings = {
10
+ fuzzySearch: this.$element.data('fuzzySearch'),
11
+ includePrompt: this.$element.data('includePrompt'),
12
+ optionClass: this.$element.data('optionClass'),
13
+ text: {
14
+ selectless: this.$element.data('text-selectless') || Selectpicker.DEFAULTS.text.selectless,
15
+ placeholder: this.$element.data('text-placeholder') || Selectpicker.DEFAULTS.text.placeholder,
16
+ prompt: this.$element.data('text-prompt') || Selectpicker.DEFAULTS.text.prompt,
17
+ }
18
+ };
19
+ this.options = $.extend({}, Selectpicker.DEFAULTS, this.settings, options);
20
+
21
+ this.$fuzzyId = 'bsSelectpicker-fuzzy-' + this.randomNumber();
22
+ this.$widget = $(this.initWidget()).on('click', $.proxy(this.clickWidget, this));
23
+
24
+ this.init();
25
+ };
26
+
27
+ if (!$.fn.dropdown) throw new Error('Selectpicker requires dropdown.js');
28
+ if (!$.fn.list) throw new Error('Selectpicker requires list.js');
29
+
30
+ Selectpicker.VERSION = '1.0.0';
31
+ Selectpicker.DEFAULTS = {
32
+ fuzzySearch: true,
33
+ includePrompt: true,
34
+ item: '<li></li>',
35
+ menu: '<ul class="selectpicker dropmenu caret"><span></span></ul>',
36
+ onSetValCallback: function (select) {},
37
+ optionClass: 'text-color-hover-blue',
38
+ text: {
39
+ selectless: 'No options available',
40
+ placeholder: 'Filter options...',
41
+ prompt: 'None'
42
+ }
43
+ };
44
+
45
+ Selectpicker.prototype.constructor = Selectpicker;
46
+
47
+ Selectpicker.prototype.init = function () {
48
+ if (!this.hasSelects()) return;
49
+
50
+ this.setWidget();
51
+
52
+ this.$element.on('mousedown', function(e) {
53
+ e.preventDefault();
54
+ this.blur();
55
+ this.focus();
56
+ }).on({
57
+ 'focus.bs.selectpicker': $.proxy(this.showWidget, this),
58
+ 'click.bs.selectpicker': $.proxy(this.showWidget, this),
59
+ 'blur.bs.selectpicker': $.proxy(this.setVal, this)
60
+ });
61
+ };
62
+
63
+ Selectpicker.prototype.clickWidget = function (e) {
64
+ e.stopPropagation();
65
+ e.preventDefault();
66
+
67
+ var value = $(e.target).data('val');
68
+
69
+ this.setVal(value);
70
+ };
71
+
72
+ Selectpicker.prototype.initWidget = function () {
73
+ var _self = this;
74
+ var menu = $(this.options.menu);
75
+
76
+ if (this.options.fuzzySearch && this.hasFuzzyAmount()) {
77
+ menu.attr('data-toggle', 'list')
78
+ .attr('data-input', '#' + this.$fuzzyId)
79
+ .find('span')
80
+ .append(this.fuzzyTemplate());
81
+ }
82
+
83
+ $.each(this.getOptions(), function (index, hash) {
84
+ var item = $(_self.options.item);
85
+
86
+ item.append(_self.optionTemplate(hash));
87
+
88
+ menu.find('span')
89
+ .append(item);
90
+ });
91
+
92
+ return menu;
93
+ };
94
+
95
+ Selectpicker.prototype.setWidget = function () {
96
+ this.$container = $('<span>')
97
+ .addClass('btn-group dropdown bsSelectpicker')
98
+ .css({
99
+ height: 0,
100
+ position: 'absolute',
101
+ width: 0
102
+ });
103
+
104
+ try {
105
+ this.$container.append(this.$widget);
106
+ this.$element.after(this.$container);
107
+ } catch(e) {
108
+ // Do nothing
109
+ }
110
+ };
111
+
112
+ Selectpicker.prototype.showWidget = function (e) {
113
+ this.$container.addClass('open');
114
+
115
+ var _self = this;
116
+ $(document).on('mousedown.bs.selectpicker, touchend.bs.selectpicker', function (e) {
117
+ if (!(_self.$element.parent().find(e.target).length ||
118
+ _self.$widget.is(e.target) ||
119
+ _self.$widget.find(e.target).length)) {
120
+ _self.hideWidget();
121
+ }
122
+ });
123
+ };
124
+
125
+ Selectpicker.prototype.hideWidget = function () {
126
+ this.$container.removeClass('open');
127
+ };
128
+
129
+ Selectpicker.prototype.setVal = function (value) {
130
+ if (value == '[object Object]') return;
131
+
132
+ this.$element.val(value);
133
+ this.options.onSetValCallback(value);
134
+ };
135
+
136
+ Selectpicker.prototype.randomNumber = function () {
137
+ return Math.floor((Math.random() * 100000) + 1);
138
+ };
139
+
140
+ Selectpicker.prototype.getOptions = function () {
141
+ var _self = this;
142
+ var array = [];
143
+
144
+ this.$element.find('option').each(function() {
145
+ var option = $(this);
146
+
147
+ if (!_self.options.includePrompt && option.val() === '') return;
148
+
149
+ var hash = {
150
+ text: option.text(),
151
+ value: option.val()
152
+ };
153
+
154
+ if (option.val() === '') {
155
+ hash.text = _self.options.text.prompt;
156
+ }
157
+
158
+ array.push(hash);
159
+ });
160
+
161
+ return array;
162
+ };
163
+
164
+ Selectpicker.prototype.optionCount = function () {
165
+ return this.getOptions().length;
166
+ };
167
+
168
+ Selectpicker.prototype.hasSelects = function () {
169
+ return this.optionCount() !== 0;
170
+ };
171
+
172
+ Selectpicker.prototype.hasFuzzyAmount = function () {
173
+ return this.optionCount() > 4;
174
+ };
175
+
176
+ Selectpicker.prototype.fuzzyTemplate = function () {
177
+ var container = $('<div class="form-input form-size-s">');
178
+ var textbox = $('<input type="text" placeholder="' + this.options.text.placeholder + '" id="' + this.$fuzzyId + '" autofocus>');
179
+
180
+ container.append(textbox);
181
+
182
+ var item = $(this.options.item);
183
+ item.addClass('selectpicker-fuzzy list-skip-filter')
184
+ .append(container);
185
+
186
+ return item;
187
+ };
188
+
189
+ Selectpicker.prototype.optionTemplate = function (hash) {
190
+ return '<a href="#" class="' +
191
+ this.options.optionClass +
192
+ '" data-val="' +
193
+ hash.value +
194
+ '">' +
195
+ hash.text +
196
+ '</a>';
197
+ };
198
+
199
+ // SELECTPICKER PLUGIN DEFINITION
200
+ // ==============================
201
+
202
+ function Plugin(option) {
203
+ return this.each(function () {
204
+ var $this = $(this);
205
+ var data = $this.data('bs.selectpicker');
206
+ var options = typeof option === 'object' && option;
207
+
208
+ if (!data) $this.data('bs.selectpicker', (data = new Selectpicker(this, options)));
209
+ if (typeof option === 'string') data[option]();
210
+ });
211
+ }
212
+
213
+ var old = $.fn.selectpicker;
214
+
215
+ $.fn.selectpicker = Plugin;
216
+ $.fn.selectpicker.Constructor = Selectpicker;
217
+
218
+ // SELECTPICKER NO CONFLICT
219
+ // ========================
220
+
221
+ $.fn.selectpicker.noConflict = function () {
222
+ $.fn.selectpicker = old;
223
+ return this;
224
+ };
225
+
226
+ // SELECTPICKER DATA-API
227
+ // =====================
228
+
229
+ $(document)
230
+ .on('ready.bs.selectpicker.data-api', function () {
231
+ $('[data-toggle="selectpicker"]').each(function () {
232
+ var $this = $(this);
233
+ if ($this.data('selectpicker')) return;
234
+ Plugin.call($this, $this.data());
235
+ });
236
+ }).on('focus.bs.selectpicker.data-api click.bs.selectpicker.data-api', '[data-toggle="selectpicker"]', function (e) {
237
+ var $this = $(this);
238
+ if ($this.data('selectpicker')) return;
239
+ Plugin.call($this, $this.data());
240
+ });
241
+
242
+ }(jQuery);
@@ -43,6 +43,7 @@
43
43
  @import 'components/choicepicker';
44
44
  @import 'components/colorpicker';
45
45
  @import 'components/datepicker';
46
+ @import 'components/selectpicker';
46
47
  @import 'components/timepicker';
47
48
  @import 'components/typeahead';
48
49
  @import 'components/ad';
@@ -371,6 +371,7 @@ textarea {
371
371
  &:checked + label {
372
372
  background: color(green);
373
373
  border-color: color(green);
374
+ box-shadow: none !important;
374
375
  color: color(white);
375
376
  }
376
377
  &[disabled]:checked + label {
@@ -0,0 +1,40 @@
1
+ // Table of Contents
2
+ // ==================================================
3
+ // Selectpicker
4
+
5
+ // scss-lint:disable NestingDepth
6
+ // scss-lint:disable SelectorDepth
7
+ // scss-lint:disable SelectorFormat
8
+
9
+ // Selectpicker
10
+ // ==================================================
11
+ .selectpicker {
12
+ > span {
13
+ display: block;
14
+ max-height: 230px;
15
+ overflow-x: auto;
16
+
17
+ > li {
18
+ border-top: 1px solid;
19
+ border-top-color: inherit;
20
+ clear: both;
21
+ display: block;
22
+ font-weight: inherit;
23
+ line-height: 1;
24
+ padding: 6px 0;
25
+ margin: 0;
26
+
27
+ &:first-child {
28
+ border-top: 0;
29
+ > a { padding-top: 10px; }
30
+ }
31
+ &:last-child {
32
+ > a { padding-bottom: 10px; }
33
+ }
34
+
35
+ &.hidden { display: none; }
36
+ &.selectpicker-fuzzy { padding: 10px 10px 5px; }
37
+ &.bsListEmpty { padding: 16px 20px; }
38
+ }
39
+ }
40
+ }
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.78
4
+ version: 14.0.79
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-07 00:00:00.000000000 Z
11
+ date: 2017-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -234,6 +234,7 @@ files:
234
234
  - vendor/assets/javascripts/base/_modal.js
235
235
  - vendor/assets/javascripts/base/_popover.js
236
236
  - vendor/assets/javascripts/base/_scrollspy.js
237
+ - vendor/assets/javascripts/base/_selectpicker.js
237
238
  - vendor/assets/javascripts/base/_switch.js
238
239
  - vendor/assets/javascripts/base/_tab.js
239
240
  - vendor/assets/javascripts/base/_table.js
@@ -294,6 +295,7 @@ files:
294
295
  - vendor/assets/stylesheets/components/_placeholder.scss
295
296
  - vendor/assets/stylesheets/components/_popover.scss
296
297
  - vendor/assets/stylesheets/components/_progress.scss
298
+ - vendor/assets/stylesheets/components/_selectpicker.scss
297
299
  - vendor/assets/stylesheets/components/_sidebar.scss
298
300
  - vendor/assets/stylesheets/components/_spinner.scss
299
301
  - vendor/assets/stylesheets/components/_switch.scss