effective_form_inputs 0.8.6 → 0.8.7

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: 9669ce7ecda604b1c0bd0ef1bbaddcf6dcbbb0cb
4
- data.tar.gz: 16032e2ed35d105bebee6a0cdc4e9395742b9b32
3
+ metadata.gz: 5e29d7adcba10153ba227c0a57d8f932751c0421
4
+ data.tar.gz: e9ce8f96ea31f6c403dc5c7a72e44b3e21dd045a
5
5
  SHA512:
6
- metadata.gz: 25abb4767be706f8b4fc5465c626b85be207b8c96501c34a9627c1efcf3ae815b716436aaaad530e3f82cccdf43144af3525494fff0e625d781423ddc2128077
7
- data.tar.gz: 3549365f9f6a87246958cff727c73e46b5345da77e39ec46ae834849dcf791a2d0beb832952b87073458be89ab07410c07833d3f26fa67e59aaa0bda6f773515
6
+ metadata.gz: 072a6b75bed552aaa270adfa8a3b2c4629e9459a29622d7eaaf32f91ee29a8d0fb9a19920ef17f352c583fa51d87176b04a306d5a97fddba2f61a51c1d4c79f6
7
+ data.tar.gz: 31e2f0a827ba0aafd096e10983ea9ea1067d4a8e1b386c983c316c0d750aeb13fcd678a999a01164e0074f31b427e07a22cc6b3855c044309a3e14a12147fdb1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Select2 4.0.0
2
+ * Select2 4.0.1
3
3
  * https://select2.github.io
4
4
  *
5
5
  * Released under the MIT license
@@ -30,7 +30,7 @@
30
30
  var S2;(function () { if (!S2 || !S2.requirejs) {
31
31
  if (!S2) { S2 = {}; } else { require = S2; }
32
32
  /**
33
- * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
33
+ * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
34
34
  * Available via the MIT or new BSD license.
35
35
  * see: http://github.com/jrburke/almond for details
36
36
  */
@@ -75,12 +75,6 @@ var requirejs, require, define;
75
75
  //otherwise, assume it is a top-level require that will
76
76
  //be relative to baseUrl in the end.
77
77
  if (baseName) {
78
- //Convert baseName to array, and lop off the last part,
79
- //so that . matches that "directory" and not name of the baseName's
80
- //module. For instance, baseName of "one/two/three", maps to
81
- //"one/two/three.js", but we want the directory, "one/two" for
82
- //this normalization.
83
- baseParts = baseParts.slice(0, baseParts.length - 1);
84
78
  name = name.split('/');
85
79
  lastIndex = name.length - 1;
86
80
 
@@ -89,7 +83,11 @@ var requirejs, require, define;
89
83
  name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
90
84
  }
91
85
 
92
- name = baseParts.concat(name);
86
+ //Lop off the last part of baseParts, so that . matches the
87
+ //"directory" and not name of the baseName's module. For instance,
88
+ //baseName of "one/two/three", maps to "one/two/three.js", but we
89
+ //want the directory, "one/two" for this normalization.
90
+ name = baseParts.slice(0, baseParts.length - 1).concat(name);
93
91
 
94
92
  //start trimDots
95
93
  for (i = 0; i < name.length; i += 1) {
@@ -181,7 +179,15 @@ var requirejs, require, define;
181
179
  //A version of a require function that passes a moduleName
182
180
  //value for items that may need to
183
181
  //look up paths relative to the moduleName
184
- return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
182
+ var args = aps.call(arguments, 0);
183
+
184
+ //If first arg is not require('string'), and there is only
185
+ //one arg, it is the array form without a callback. Insert
186
+ //a null so that the following concat is correct.
187
+ if (typeof args[0] !== 'string' && args.length === 1) {
188
+ args.push(null);
189
+ }
190
+ return req.apply(undef, args.concat([relName, forceSync]));
185
191
  };
186
192
  }
187
193
 
@@ -431,6 +437,9 @@ var requirejs, require, define;
431
437
  requirejs._defined = defined;
432
438
 
433
439
  define = function (name, deps, callback) {
440
+ if (typeof name !== 'string') {
441
+ throw new Error('See almond README: incorrect module build, no module name');
442
+ }
434
443
 
435
444
  //This module may not have dependencies
436
445
  if (!deps.splice) {
@@ -773,7 +782,8 @@ S2.define('select2/results',[
773
782
  this.hideLoading();
774
783
 
775
784
  var $message = $(
776
- '<li role="treeitem" class="select2-results__option"></li>'
785
+ '<li role="treeitem" aria-live="assertive"' +
786
+ ' class="select2-results__option"></li>'
777
787
  );
778
788
 
779
789
  var message = this.options.get('translations').get(params.message);
@@ -784,9 +794,15 @@ S2.define('select2/results',[
784
794
  )
785
795
  );
786
796
 
797
+ $message[0].className += ' select2-results__message';
798
+
787
799
  this.$results.append($message);
788
800
  };
789
801
 
802
+ Results.prototype.hideMessages = function () {
803
+ this.$results.find('.select2-results__message').remove();
804
+ };
805
+
790
806
  Results.prototype.append = function (data) {
791
807
  this.hideLoading();
792
808
 
@@ -986,6 +1002,7 @@ S2.define('select2/results',[
986
1002
  });
987
1003
 
988
1004
  container.on('query', function (params) {
1005
+ self.hideMessages();
989
1006
  self.showLoading(params);
990
1007
  });
991
1008
 
@@ -1229,7 +1246,7 @@ S2.define('select2/results',[
1229
1246
  var template = this.options.get('templateResult');
1230
1247
  var escapeMarkup = this.options.get('escapeMarkup');
1231
1248
 
1232
- var content = template(result);
1249
+ var content = template(result, container);
1233
1250
 
1234
1251
  if (content == null) {
1235
1252
  container.style.display = 'none';
@@ -1286,7 +1303,7 @@ S2.define('select2/selection/base',[
1286
1303
  BaseSelection.prototype.render = function () {
1287
1304
  var $selection = $(
1288
1305
  '<span class="select2-selection" role="combobox" ' +
1289
- 'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' +
1306
+ ' aria-haspopup="true" aria-expanded="false">' +
1290
1307
  '</span>'
1291
1308
  );
1292
1309
 
@@ -1369,7 +1386,7 @@ S2.define('select2/selection/base',[
1369
1386
  BaseSelection.prototype._handleBlur = function (evt) {
1370
1387
  var self = this;
1371
1388
 
1372
- // This needs to be delayed as the actve element is the body when the tab
1389
+ // This needs to be delayed as the active element is the body when the tab
1373
1390
  // key is pressed, possibly along with others.
1374
1391
  window.setTimeout(function () {
1375
1392
  // Don't trigger `blur` if the focus is still in the selection
@@ -1794,7 +1811,7 @@ S2.define('select2/selection/search',[
1794
1811
  '<li class="select2-search select2-search--inline">' +
1795
1812
  '<input class="select2-search__field" type="search" tabindex="-1"' +
1796
1813
  ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
1797
- ' spellcheck="false" role="textbox" />' +
1814
+ ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1798
1815
  '</li>'
1799
1816
  );
1800
1817
 
@@ -1819,6 +1836,7 @@ S2.define('select2/selection/search',[
1819
1836
 
1820
1837
  container.on('close', function () {
1821
1838
  self.$search.val('');
1839
+ self.$search.removeAttr('aria-activedescendant');
1822
1840
  self.$search.trigger('focus');
1823
1841
  });
1824
1842
 
@@ -1836,6 +1854,10 @@ S2.define('select2/selection/search',[
1836
1854
  self.$search.trigger('focus');
1837
1855
  });
1838
1856
 
1857
+ container.on('results:focus', function (params) {
1858
+ self.$search.attr('aria-activedescendant', params.id);
1859
+ });
1860
+
1839
1861
  this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1840
1862
  self.trigger('focus', evt);
1841
1863
  });
@@ -1867,6 +1889,14 @@ S2.define('select2/selection/search',[
1867
1889
  }
1868
1890
  });
1869
1891
 
1892
+ // Try to detect the IE version should the `documentMode` property that
1893
+ // is stored on the document. This is only implemented in IE and is
1894
+ // slightly cleaner than doing a user agent check.
1895
+ // This property is not available in Edge, but Edge also doesn't have
1896
+ // this bug.
1897
+ var msie = document.documentMode;
1898
+ var disableInputEvents = msie && msie <= 11;
1899
+
1870
1900
  // Workaround for browsers which do not support the `input` event
1871
1901
  // This will prevent double-triggering of events for browsers which support
1872
1902
  // both the `keyup` and `input` events.
@@ -1874,17 +1904,10 @@ S2.define('select2/selection/search',[
1874
1904
  'input.searchcheck',
1875
1905
  '.select2-search--inline',
1876
1906
  function (evt) {
1877
- // Try to detect the IE version should the `documentMode` property that
1878
- // is stored on the document. This is only implemented in IE and is
1879
- // slightly cleaner than doing a user agent check.
1880
- // This property is not available in Edge, but Edge also doesn't have
1881
- // this bug.
1882
- var msie = document.documentMode;
1883
-
1884
1907
  // IE will trigger the `input` event when a placeholder is used on a
1885
1908
  // search box. To get around this issue, we are forced to ignore all
1886
1909
  // `input` events in IE and keep using `keyup`.
1887
- if (msie && msie <= 11) {
1910
+ if (disableInputEvents) {
1888
1911
  self.$selection.off('input.search input.searchcheck');
1889
1912
  return;
1890
1913
  }
@@ -1898,6 +1921,14 @@ S2.define('select2/selection/search',[
1898
1921
  'keyup.search input.search',
1899
1922
  '.select2-search--inline',
1900
1923
  function (evt) {
1924
+ // IE will trigger the `input` event when a placeholder is used on a
1925
+ // search box. To get around this issue, we are forced to ignore all
1926
+ // `input` events in IE and keep using `keyup`.
1927
+ if (disableInputEvents && evt.type === 'input') {
1928
+ self.$selection.off('input.search input.searchcheck');
1929
+ return;
1930
+ }
1931
+
1901
1932
  var key = evt.which;
1902
1933
 
1903
1934
  // We can freely ignore events from modifier keys
@@ -1966,9 +1997,8 @@ S2.define('select2/selection/search',[
1966
1997
  data: item
1967
1998
  });
1968
1999
 
1969
- this.trigger('open', {});
1970
-
1971
- this.$search.val(item.text + ' ');
2000
+ this.$search.val(item.text);
2001
+ this.handleSearch();
1972
2002
  };
1973
2003
 
1974
2004
  Search.prototype.resizeSearch = function () {
@@ -3348,9 +3378,9 @@ S2.define('select2/data/ajax',[
3348
3378
  AjaxAdapter.prototype._applyDefaults = function (options) {
3349
3379
  var defaults = {
3350
3380
  data: function (params) {
3351
- return {
3381
+ return $.extend({}, params, {
3352
3382
  q: params.term
3353
- };
3383
+ });
3354
3384
  },
3355
3385
  transport: function (params, success, failure) {
3356
3386
  var $request = $.ajax(params);
@@ -3387,11 +3417,11 @@ S2.define('select2/data/ajax',[
3387
3417
  }, this.ajaxOptions);
3388
3418
 
3389
3419
  if (typeof options.url === 'function') {
3390
- options.url = options.url(params);
3420
+ options.url = options.url.call(this.$element, params);
3391
3421
  }
3392
3422
 
3393
3423
  if (typeof options.data === 'function') {
3394
- options.data = options.data(params);
3424
+ options.data = options.data.call(this.$element, params);
3395
3425
  }
3396
3426
 
3397
3427
  function request () {
@@ -3766,6 +3796,10 @@ S2.define('select2/dropdown',[
3766
3796
  return $dropdown;
3767
3797
  };
3768
3798
 
3799
+ Dropdown.prototype.bind = function () {
3800
+ // Should be implemented in subclasses
3801
+ };
3802
+
3769
3803
  Dropdown.prototype.position = function ($dropdown, $container) {
3770
3804
  // Should be implmented in subclasses
3771
3805
  };
@@ -3992,7 +4026,9 @@ S2.define('select2/dropdown/infiniteScroll',[
3992
4026
 
3993
4027
  InfiniteScroll.prototype.createLoadingMore = function () {
3994
4028
  var $option = $(
3995
- '<li class="option load-more" role="treeitem"></li>'
4029
+ '<li ' +
4030
+ 'class="select2-results__option select2-results__option--load-more"' +
4031
+ 'role="treeitem" aria-disabled="true"></li>'
3996
4032
  );
3997
4033
 
3998
4034
  var message = this.options.get('translations').get('loadingMore');
@@ -4010,7 +4046,7 @@ S2.define('select2/dropdown/attachBody',[
4010
4046
  '../utils'
4011
4047
  ], function ($, Utils) {
4012
4048
  function AttachBody (decorated, $element, options) {
4013
- this.$dropdownParent = options.get('dropdownParent') || document.body;
4049
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4014
4050
 
4015
4051
  decorated.call(this, $element, options);
4016
4052
  }
@@ -4087,7 +4123,8 @@ S2.define('select2/dropdown/attachBody',[
4087
4123
  this.$dropdownContainer.detach();
4088
4124
  };
4089
4125
 
4090
- AttachBody.prototype._attachPositioningHandler = function (container) {
4126
+ AttachBody.prototype._attachPositioningHandler =
4127
+ function (decorated, container) {
4091
4128
  var self = this;
4092
4129
 
4093
4130
  var scrollEvent = 'scroll.select2.' + container.id;
@@ -4114,7 +4151,8 @@ S2.define('select2/dropdown/attachBody',[
4114
4151
  });
4115
4152
  };
4116
4153
 
4117
- AttachBody.prototype._detachPositioningHandler = function (container) {
4154
+ AttachBody.prototype._detachPositioningHandler =
4155
+ function (decorated, container) {
4118
4156
  var scrollEvent = 'scroll.select2.' + container.id;
4119
4157
  var resizeEvent = 'resize.select2.' + container.id;
4120
4158
  var orientationEvent = 'orientationchange.select2.' + container.id;
@@ -4162,6 +4200,14 @@ S2.define('select2/dropdown/attachBody',[
4162
4200
  top: container.bottom
4163
4201
  };
4164
4202
 
4203
+ // Fix positioning with static parents
4204
+ if (this.$dropdownParent[0].style.position !== 'static') {
4205
+ var parentOffset = this.$dropdownParent.offset();
4206
+
4207
+ css.top -= parentOffset.top;
4208
+ css.left -= parentOffset.left;
4209
+ }
4210
+
4165
4211
  if (!isCurrentlyAbove && !isCurrentlyBelow) {
4166
4212
  newDirection = 'below';
4167
4213
  }
@@ -4270,12 +4316,23 @@ S2.define('select2/dropdown/selectOnClose',[
4270
4316
  SelectOnClose.prototype._handleSelectOnClose = function () {
4271
4317
  var $highlightedResults = this.getHighlightedResults();
4272
4318
 
4319
+ // Only select highlighted results
4273
4320
  if ($highlightedResults.length < 1) {
4274
4321
  return;
4275
4322
  }
4276
4323
 
4324
+ var data = $highlightedResults.data('data');
4325
+
4326
+ // Don't re-select already selected resulte
4327
+ if (
4328
+ (data.element != null && data.element.selected) ||
4329
+ (data.element == null && data.selected)
4330
+ ) {
4331
+ return;
4332
+ }
4333
+
4277
4334
  this.trigger('select', {
4278
- data: $highlightedResults.data('data')
4335
+ data: data
4279
4336
  });
4280
4337
  };
4281
4338
 
@@ -5240,6 +5297,10 @@ S2.define('select2/core',[
5240
5297
  'unselect': 'unselecting'
5241
5298
  };
5242
5299
 
5300
+ if (args === undefined) {
5301
+ args = {};
5302
+ }
5303
+
5243
5304
  if (name in preTriggerMap) {
5244
5305
  var preTriggerName = preTriggerMap[name];
5245
5306
  var preTriggerArgs = {
@@ -5422,16 +5483,20 @@ S2.define('select2/core',[
5422
5483
  return Select2;
5423
5484
  });
5424
5485
 
5486
+ S2.define('jquery-mousewheel',[
5487
+ 'jquery'
5488
+ ], function ($) {
5489
+ // Used to shim jQuery.mousewheel for non-full builds.
5490
+ return $;
5491
+ });
5492
+
5425
5493
  S2.define('jquery.select2',[
5426
5494
  'jquery',
5427
- 'require',
5495
+ 'jquery-mousewheel',
5428
5496
 
5429
5497
  './select2/core',
5430
5498
  './select2/defaults'
5431
- ], function ($, require, Select2, Defaults) {
5432
- // Force jQuery.mousewheel to be loaded if it hasn't already
5433
- require('jquery.mousewheel');
5434
-
5499
+ ], function ($, _, Select2, Defaults) {
5435
5500
  if ($.fn.select2 == null) {
5436
5501
  // All methods that should return the element
5437
5502
  var thisMethods = ['open', 'close', 'destroy'];
@@ -5441,25 +5506,29 @@ S2.define('jquery.select2',[
5441
5506
 
5442
5507
  if (typeof options === 'object') {
5443
5508
  this.each(function () {
5444
- var instanceOptions = $.extend({}, options, true);
5509
+ var instanceOptions = $.extend(true, {}, options);
5445
5510
 
5446
5511
  var instance = new Select2($(this), instanceOptions);
5447
5512
  });
5448
5513
 
5449
5514
  return this;
5450
5515
  } else if (typeof options === 'string') {
5451
- var instance = this.data('select2');
5516
+ var ret;
5452
5517
 
5453
- if (instance == null && window.console && console.error) {
5454
- console.error(
5455
- 'The select2(\'' + options + '\') method was called on an ' +
5456
- 'element that is not using Select2.'
5457
- );
5458
- }
5518
+ this.each(function () {
5519
+ var instance = $(this).data('select2');
5520
+
5521
+ if (instance == null && window.console && console.error) {
5522
+ console.error(
5523
+ 'The select2(\'' + options + '\') method was called on an ' +
5524
+ 'element that is not using Select2.'
5525
+ );
5526
+ }
5459
5527
 
5460
- var args = Array.prototype.slice.call(arguments, 1);
5528
+ var args = Array.prototype.slice.call(arguments, 1);
5461
5529
 
5462
- var ret = instance[options](args);
5530
+ ret = instance[options].apply(instance, args);
5531
+ });
5463
5532
 
5464
5533
  // Check if we should be returning `this`
5465
5534
  if ($.inArray(options, thisMethods) > -1) {
@@ -5480,13 +5549,6 @@ S2.define('jquery.select2',[
5480
5549
  return Select2;
5481
5550
  });
5482
5551
 
5483
- S2.define('jquery.mousewheel',[
5484
- 'jquery'
5485
- ], function ($) {
5486
- // Used to shim jQuery.mousewheel for non-full builds.
5487
- return $;
5488
- });
5489
-
5490
5552
  // Return the AMD loader configuration so it can be used outside of this file
5491
5553
  return {
5492
5554
  define: S2.define,
@@ -12,6 +12,10 @@
12
12
  width: 10px;
13
13
  }
14
14
 
15
+ .select2-container .select2-search--inline .select2-search__field {
16
+ width: 100% !important;
17
+ }
18
+
15
19
  .select2-container--focus:not(.select2-container--open) {
16
20
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
17
21
  outline: 0 none;
@@ -18,6 +18,8 @@
18
18
  overflow: hidden;
19
19
  text-overflow: ellipsis;
20
20
  white-space: nowrap; }
21
+ .select2-container .select2-selection--single .select2-selection__clear {
22
+ position: relative; }
21
23
  .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
22
24
  padding-right: 8px;
23
25
  padding-left: 20px; }
@@ -247,7 +249,8 @@
247
249
  background: transparent;
248
250
  border: none;
249
251
  outline: 0;
250
- box-shadow: none; }
252
+ box-shadow: none;
253
+ -webkit-appearance: textfield; }
251
254
 
252
255
  .select2-container--default .select2-results > .select2-results__options {
253
256
  max-height: 200px;
@@ -1,3 +1,3 @@
1
1
  module EffectiveFormInputs
2
- VERSION = '0.8.6'.freeze
2
+ VERSION = '0.8.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_form_inputs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-30 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails