effective_form_inputs 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -27
- data/app/assets/javascripts/effective_select/select2.js +171 -66
- data/app/assets/stylesheets/effective_select/overrides.scss +9 -0
- data/app/assets/stylesheets/effective_select/select2.css +74 -26
- data/lib/effective_form_inputs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95f0fe620b21c40e0ac46f0ef1fa5d4f5d2cc540
|
4
|
+
data.tar.gz: 5422d218ea19c12c505bcaaa4878d34f1ccc99cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aef0cd4cf861b48f2bcad05a144e3db91395c500159dd86758c7356bd848b2dab1de786756c74bd158eafe9cd0effbfc39875b6538c12d7dd8ef47c2fe72c0c5
|
7
|
+
data.tar.gz: b0d77403bfd7c5c8519155a9103fc3ad8b16475bb2b6754d3286d2e7bd34e32af00dee770363ab92870dfc3102bfc1dbdb87c0c36aebddc0d580991f521196e4
|
data/README.md
CHANGED
@@ -42,6 +42,34 @@ and add the following to your application.css:
|
|
42
42
|
|
43
43
|
All of the included form inputs will now be available with no additional installation tasks.
|
44
44
|
|
45
|
+
### Options Passing to JavaScript
|
46
|
+
|
47
|
+
All `:input_js => options` passed to any effective_form_input will be used to initialize the Javascript library
|
48
|
+
|
49
|
+
For example:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
= form_for @user do |f|
|
53
|
+
= f.effective_date_time_picker :updated_at, :input_js => {:format => 'dddd, MMMM Do YYYY', :showTodayButton => true}
|
54
|
+
```
|
55
|
+
|
56
|
+
or
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
= simple_form_for @user do |f|
|
60
|
+
= f.input :updated_at, :as => :effective_date_time_picker, :input_js => {:format => 'dddd, MMMM Do YYYY', :showTodayButton => true}
|
61
|
+
```
|
62
|
+
|
63
|
+
will result in the following call to the Javascript library:
|
64
|
+
|
65
|
+
```coffee
|
66
|
+
$('input.effective_date_time_picker').datetimepicker
|
67
|
+
format: 'dddd, MMMM Do YYYY',
|
68
|
+
showTodayButton: true
|
69
|
+
```
|
70
|
+
|
71
|
+
Any options passed in this way will be used to initialize the underlying javascript libraries.
|
72
|
+
|
45
73
|
|
46
74
|
## Effective Date Time Picker
|
47
75
|
|
@@ -383,33 +411,6 @@ There are no javascript options for this input.
|
|
383
411
|
This input also installs a rails view helper `price_to_currency` that takes a value like `10000` and displays it as `$100.00`
|
384
412
|
|
385
413
|
|
386
|
-
|
387
|
-
## Passing Options to JavaScript Behaviour
|
388
|
-
|
389
|
-
All `:input_js => options` passed to any effective_form_input will be used to initialize the Javascript library
|
390
|
-
|
391
|
-
For example:
|
392
|
-
|
393
|
-
```ruby
|
394
|
-
= form_for @user do |f|
|
395
|
-
= f.effective_date_time_picker :updated_at, :input_js => {:format => 'dddd, MMMM Do YYYY', :showTodayButton => true}
|
396
|
-
```
|
397
|
-
|
398
|
-
or
|
399
|
-
|
400
|
-
```ruby
|
401
|
-
= simple_form_for @user do |f|
|
402
|
-
= f.input :updated_at, :as => :effective_date_time_picker, :input_js => {:format => 'dddd, MMMM Do YYYY', :showTodayButton => true}
|
403
|
-
```
|
404
|
-
|
405
|
-
will result in the following call to the Javascript library:
|
406
|
-
|
407
|
-
```coffee
|
408
|
-
$('input.effective_date_time_picker').datetimepicker
|
409
|
-
format: 'dddd, MMMM Do YYYY',
|
410
|
-
showTodayButton: true
|
411
|
-
```
|
412
|
-
|
413
414
|
## License
|
414
415
|
|
415
416
|
MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
|
@@ -1041,7 +1041,7 @@ S2.define('select2/results',[
|
|
1041
1041
|
var data = $highlighted.data('data');
|
1042
1042
|
|
1043
1043
|
if ($highlighted.attr('aria-selected') == 'true') {
|
1044
|
-
self.trigger('close');
|
1044
|
+
self.trigger('close', {});
|
1045
1045
|
} else {
|
1046
1046
|
self.trigger('select', {
|
1047
1047
|
data: data
|
@@ -1163,7 +1163,7 @@ S2.define('select2/results',[
|
|
1163
1163
|
data: data
|
1164
1164
|
});
|
1165
1165
|
} else {
|
1166
|
-
self.trigger('close');
|
1166
|
+
self.trigger('close', {});
|
1167
1167
|
}
|
1168
1168
|
|
1169
1169
|
return;
|
@@ -1319,7 +1319,7 @@ S2.define('select2/selection/base',[
|
|
1319
1319
|
});
|
1320
1320
|
|
1321
1321
|
this.$selection.on('blur', function (evt) {
|
1322
|
-
self.
|
1322
|
+
self._handleBlur(evt);
|
1323
1323
|
});
|
1324
1324
|
|
1325
1325
|
this.$selection.on('keydown', function (evt) {
|
@@ -1366,6 +1366,24 @@ S2.define('select2/selection/base',[
|
|
1366
1366
|
});
|
1367
1367
|
};
|
1368
1368
|
|
1369
|
+
BaseSelection.prototype._handleBlur = function (evt) {
|
1370
|
+
var self = this;
|
1371
|
+
|
1372
|
+
// This needs to be delayed as the actve element is the body when the tab
|
1373
|
+
// key is pressed, possibly along with others.
|
1374
|
+
window.setTimeout(function () {
|
1375
|
+
// Don't trigger `blur` if the focus is still in the selection
|
1376
|
+
if (
|
1377
|
+
(document.activeElement == self.$selection[0]) ||
|
1378
|
+
($.contains(self.$selection[0], document.activeElement))
|
1379
|
+
) {
|
1380
|
+
return;
|
1381
|
+
}
|
1382
|
+
|
1383
|
+
self.trigger('blur', evt);
|
1384
|
+
}, 1);
|
1385
|
+
};
|
1386
|
+
|
1369
1387
|
BaseSelection.prototype._attachCloseHandler = function (container) {
|
1370
1388
|
var self = this;
|
1371
1389
|
|
@@ -1475,11 +1493,11 @@ S2.define('select2/selection/single',[
|
|
1475
1493
|
this.$selection.find('.select2-selection__rendered').empty();
|
1476
1494
|
};
|
1477
1495
|
|
1478
|
-
SingleSelection.prototype.display = function (data) {
|
1496
|
+
SingleSelection.prototype.display = function (data, container) {
|
1479
1497
|
var template = this.options.get('templateSelection');
|
1480
1498
|
var escapeMarkup = this.options.get('escapeMarkup');
|
1481
1499
|
|
1482
|
-
return escapeMarkup(template(data));
|
1500
|
+
return escapeMarkup(template(data, container));
|
1483
1501
|
};
|
1484
1502
|
|
1485
1503
|
SingleSelection.prototype.selectionContainer = function () {
|
@@ -1494,9 +1512,9 @@ S2.define('select2/selection/single',[
|
|
1494
1512
|
|
1495
1513
|
var selection = data[0];
|
1496
1514
|
|
1497
|
-
var formatted = this.display(selection);
|
1498
|
-
|
1499
1515
|
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1516
|
+
var formatted = this.display(selection, $rendered);
|
1517
|
+
|
1500
1518
|
$rendered.empty().append(formatted);
|
1501
1519
|
$rendered.prop('title', selection.title || selection.text);
|
1502
1520
|
};
|
@@ -1538,29 +1556,37 @@ S2.define('select2/selection/multiple',[
|
|
1538
1556
|
});
|
1539
1557
|
});
|
1540
1558
|
|
1541
|
-
this.$selection.on(
|
1559
|
+
this.$selection.on(
|
1560
|
+
'click',
|
1561
|
+
'.select2-selection__choice__remove',
|
1542
1562
|
function (evt) {
|
1543
|
-
|
1544
|
-
|
1563
|
+
// Ignore the event if it is disabled
|
1564
|
+
if (self.options.get('disabled')) {
|
1565
|
+
return;
|
1566
|
+
}
|
1545
1567
|
|
1546
|
-
|
1568
|
+
var $remove = $(this);
|
1569
|
+
var $selection = $remove.parent();
|
1547
1570
|
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1571
|
+
var data = $selection.data('data');
|
1572
|
+
|
1573
|
+
self.trigger('unselect', {
|
1574
|
+
originalEvent: evt,
|
1575
|
+
data: data
|
1576
|
+
});
|
1577
|
+
}
|
1578
|
+
);
|
1553
1579
|
};
|
1554
1580
|
|
1555
1581
|
MultipleSelection.prototype.clear = function () {
|
1556
1582
|
this.$selection.find('.select2-selection__rendered').empty();
|
1557
1583
|
};
|
1558
1584
|
|
1559
|
-
MultipleSelection.prototype.display = function (data) {
|
1585
|
+
MultipleSelection.prototype.display = function (data, container) {
|
1560
1586
|
var template = this.options.get('templateSelection');
|
1561
1587
|
var escapeMarkup = this.options.get('escapeMarkup');
|
1562
1588
|
|
1563
|
-
return escapeMarkup(template(data));
|
1589
|
+
return escapeMarkup(template(data, container));
|
1564
1590
|
};
|
1565
1591
|
|
1566
1592
|
MultipleSelection.prototype.selectionContainer = function () {
|
@@ -1587,8 +1613,8 @@ S2.define('select2/selection/multiple',[
|
|
1587
1613
|
for (var d = 0; d < data.length; d++) {
|
1588
1614
|
var selection = data[d];
|
1589
1615
|
|
1590
|
-
var formatted = this.display(selection);
|
1591
1616
|
var $selection = this.selectionContainer();
|
1617
|
+
var formatted = this.display(selection, $selection);
|
1592
1618
|
|
1593
1619
|
$selection.append(formatted);
|
1594
1620
|
$selection.prop('title', selection.title || selection.text);
|
@@ -1720,7 +1746,7 @@ S2.define('select2/selection/allowClear',[
|
|
1720
1746
|
|
1721
1747
|
this.$element.val(this.placeholder.id).trigger('change');
|
1722
1748
|
|
1723
|
-
this.trigger('toggle');
|
1749
|
+
this.trigger('toggle', {});
|
1724
1750
|
};
|
1725
1751
|
|
1726
1752
|
AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
|
@@ -1777,6 +1803,8 @@ S2.define('select2/selection/search',[
|
|
1777
1803
|
|
1778
1804
|
var $rendered = decorated.call(this);
|
1779
1805
|
|
1806
|
+
this._transferTabIndex();
|
1807
|
+
|
1780
1808
|
return $rendered;
|
1781
1809
|
};
|
1782
1810
|
|
@@ -1786,32 +1814,34 @@ S2.define('select2/selection/search',[
|
|
1786
1814
|
decorated.call(this, container, $container);
|
1787
1815
|
|
1788
1816
|
container.on('open', function () {
|
1789
|
-
self.$search.
|
1790
|
-
|
1791
|
-
self.$search.focus();
|
1817
|
+
self.$search.trigger('focus');
|
1792
1818
|
});
|
1793
1819
|
|
1794
1820
|
container.on('close', function () {
|
1795
|
-
self.$search.attr('tabindex', -1);
|
1796
|
-
|
1797
1821
|
self.$search.val('');
|
1798
|
-
self.$search.focus
|
1822
|
+
self.$search.trigger('focus');
|
1799
1823
|
});
|
1800
1824
|
|
1801
1825
|
container.on('enable', function () {
|
1802
1826
|
self.$search.prop('disabled', false);
|
1827
|
+
|
1828
|
+
self._transferTabIndex();
|
1803
1829
|
});
|
1804
1830
|
|
1805
1831
|
container.on('disable', function () {
|
1806
1832
|
self.$search.prop('disabled', true);
|
1807
1833
|
});
|
1808
1834
|
|
1835
|
+
container.on('focus', function (evt) {
|
1836
|
+
self.$search.trigger('focus');
|
1837
|
+
});
|
1838
|
+
|
1809
1839
|
this.$selection.on('focusin', '.select2-search--inline', function (evt) {
|
1810
1840
|
self.trigger('focus', evt);
|
1811
1841
|
});
|
1812
1842
|
|
1813
1843
|
this.$selection.on('focusout', '.select2-search--inline', function (evt) {
|
1814
|
-
self.
|
1844
|
+
self._handleBlur(evt);
|
1815
1845
|
});
|
1816
1846
|
|
1817
1847
|
this.$selection.on('keydown', '.select2-search--inline', function (evt) {
|
@@ -1840,15 +1870,61 @@ S2.define('select2/selection/search',[
|
|
1840
1870
|
// Workaround for browsers which do not support the `input` event
|
1841
1871
|
// This will prevent double-triggering of events for browsers which support
|
1842
1872
|
// both the `keyup` and `input` events.
|
1843
|
-
this.$selection.on(
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1873
|
+
this.$selection.on(
|
1874
|
+
'input.searchcheck',
|
1875
|
+
'.select2-search--inline',
|
1876
|
+
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
|
+
// IE will trigger the `input` event when a placeholder is used on a
|
1885
|
+
// search box. To get around this issue, we are forced to ignore all
|
1886
|
+
// `input` events in IE and keep using `keyup`.
|
1887
|
+
if (msie && msie <= 11) {
|
1888
|
+
self.$selection.off('input.search input.searchcheck');
|
1889
|
+
return;
|
1890
|
+
}
|
1847
1891
|
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1892
|
+
// Unbind the duplicated `keyup` event
|
1893
|
+
self.$selection.off('keyup.search');
|
1894
|
+
}
|
1895
|
+
);
|
1896
|
+
|
1897
|
+
this.$selection.on(
|
1898
|
+
'keyup.search input.search',
|
1899
|
+
'.select2-search--inline',
|
1900
|
+
function (evt) {
|
1901
|
+
var key = evt.which;
|
1902
|
+
|
1903
|
+
// We can freely ignore events from modifier keys
|
1904
|
+
if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
|
1905
|
+
return;
|
1906
|
+
}
|
1907
|
+
|
1908
|
+
// Tabbing will be handled during the `keydown` phase
|
1909
|
+
if (key == KEYS.TAB) {
|
1910
|
+
return;
|
1911
|
+
}
|
1912
|
+
|
1913
|
+
self.handleSearch(evt);
|
1914
|
+
}
|
1915
|
+
);
|
1916
|
+
};
|
1917
|
+
|
1918
|
+
/**
|
1919
|
+
* This method will transfer the tabindex attribute from the rendered
|
1920
|
+
* selection to the search box. This allows for the search box to be used as
|
1921
|
+
* the primary focus instead of the selection container.
|
1922
|
+
*
|
1923
|
+
* @private
|
1924
|
+
*/
|
1925
|
+
Search.prototype._transferTabIndex = function (decorated) {
|
1926
|
+
this.$search.attr('tabindex', this.$selection.attr('tabindex'));
|
1927
|
+
this.$selection.attr('tabindex', '-1');
|
1852
1928
|
};
|
1853
1929
|
|
1854
1930
|
Search.prototype.createPlaceholder = function (decorated, placeholder) {
|
@@ -1856,6 +1932,8 @@ S2.define('select2/selection/search',[
|
|
1856
1932
|
};
|
1857
1933
|
|
1858
1934
|
Search.prototype.update = function (decorated, data) {
|
1935
|
+
var searchHadFocus = this.$search[0] == document.activeElement;
|
1936
|
+
|
1859
1937
|
this.$search.attr('placeholder', '');
|
1860
1938
|
|
1861
1939
|
decorated.call(this, data);
|
@@ -1864,6 +1942,9 @@ S2.define('select2/selection/search',[
|
|
1864
1942
|
.append(this.$searchContainer);
|
1865
1943
|
|
1866
1944
|
this.resizeSearch();
|
1945
|
+
if (searchHadFocus) {
|
1946
|
+
this.$search.focus();
|
1947
|
+
}
|
1867
1948
|
};
|
1868
1949
|
|
1869
1950
|
Search.prototype.handleSearch = function () {
|
@@ -1885,7 +1966,7 @@ S2.define('select2/selection/search',[
|
|
1885
1966
|
data: item
|
1886
1967
|
});
|
1887
1968
|
|
1888
|
-
this.trigger('open');
|
1969
|
+
this.trigger('open', {});
|
1889
1970
|
|
1890
1971
|
this.$search.val(item.text + ' ');
|
1891
1972
|
};
|
@@ -3223,7 +3304,7 @@ S2.define('select2/data/array',[
|
|
3223
3304
|
var existingData = this.item($existingOption);
|
3224
3305
|
var newData = $.extend(true, {}, existingData, item);
|
3225
3306
|
|
3226
|
-
var $newOption = this.option(
|
3307
|
+
var $newOption = this.option(newData);
|
3227
3308
|
|
3228
3309
|
$existingOption.replaceWith($newOption);
|
3229
3310
|
|
@@ -3259,7 +3340,7 @@ S2.define('select2/data/ajax',[
|
|
3259
3340
|
this.processResults = this.ajaxOptions.processResults;
|
3260
3341
|
}
|
3261
3342
|
|
3262
|
-
|
3343
|
+
AjaxAdapter.__super__.constructor.call(this, $element, options);
|
3263
3344
|
}
|
3264
3345
|
|
3265
3346
|
Utils.Extend(AjaxAdapter, ArrayAdapter);
|
@@ -3493,7 +3574,9 @@ S2.define('select2/data/tokenizer',[
|
|
3493
3574
|
var self = this;
|
3494
3575
|
|
3495
3576
|
function select (data) {
|
3496
|
-
self.select
|
3577
|
+
self.trigger('select', {
|
3578
|
+
data: data
|
3579
|
+
});
|
3497
3580
|
}
|
3498
3581
|
|
3499
3582
|
params.term = params.term || '';
|
@@ -3541,6 +3624,11 @@ S2.define('select2/data/tokenizer',[
|
|
3541
3624
|
|
3542
3625
|
var data = createTag(partParams);
|
3543
3626
|
|
3627
|
+
if (data == null) {
|
3628
|
+
i++;
|
3629
|
+
continue;
|
3630
|
+
}
|
3631
|
+
|
3544
3632
|
callback(data);
|
3545
3633
|
|
3546
3634
|
// Reset the term to not include the tokenized portion
|
@@ -3963,6 +4051,12 @@ S2.define('select2/dropdown/attachBody',[
|
|
3963
4051
|
});
|
3964
4052
|
};
|
3965
4053
|
|
4054
|
+
AttachBody.prototype.destroy = function (decorated) {
|
4055
|
+
decorated.call(this);
|
4056
|
+
|
4057
|
+
this.$dropdownContainer.remove();
|
4058
|
+
};
|
4059
|
+
|
3966
4060
|
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
|
3967
4061
|
// Clone all of the container classes
|
3968
4062
|
$dropdown.attr('class', $container.attr('class'));
|
@@ -4096,8 +4190,6 @@ S2.define('select2/dropdown/attachBody',[
|
|
4096
4190
|
};
|
4097
4191
|
|
4098
4192
|
AttachBody.prototype._resizeDropdown = function () {
|
4099
|
-
this.$dropdownContainer.width();
|
4100
|
-
|
4101
4193
|
var css = {
|
4102
4194
|
width: this.$container.outerWidth(false) + 'px'
|
4103
4195
|
};
|
@@ -4217,7 +4309,7 @@ S2.define('select2/dropdown/closeOnSelect',[
|
|
4217
4309
|
return;
|
4218
4310
|
}
|
4219
4311
|
|
4220
|
-
this.trigger('close');
|
4312
|
+
this.trigger('close', {});
|
4221
4313
|
};
|
4222
4314
|
|
4223
4315
|
return CloseOnSelect;
|
@@ -4868,8 +4960,8 @@ S2.define('select2/core',[
|
|
4868
4960
|
|
4869
4961
|
// Hide the original select
|
4870
4962
|
$element.addClass('select2-hidden-accessible');
|
4871
|
-
|
4872
|
-
|
4963
|
+
$element.attr('aria-hidden', 'true');
|
4964
|
+
|
4873
4965
|
// Synchronize any monitored attributes
|
4874
4966
|
this._syncAttributes();
|
4875
4967
|
|
@@ -5004,12 +5096,16 @@ S2.define('select2/core',[
|
|
5004
5096
|
|
5005
5097
|
Select2.prototype._registerSelectionEvents = function () {
|
5006
5098
|
var self = this;
|
5007
|
-
var nonRelayEvents = ['toggle'];
|
5099
|
+
var nonRelayEvents = ['toggle', 'focus'];
|
5008
5100
|
|
5009
5101
|
this.selection.on('toggle', function () {
|
5010
5102
|
self.toggleDropdown();
|
5011
5103
|
});
|
5012
5104
|
|
5105
|
+
this.selection.on('focus', function (params) {
|
5106
|
+
self.focus(params);
|
5107
|
+
});
|
5108
|
+
|
5013
5109
|
this.selection.on('*', function (name, params) {
|
5014
5110
|
if ($.inArray(name, nonRelayEvents) !== -1) {
|
5015
5111
|
return;
|
@@ -5054,17 +5150,13 @@ S2.define('select2/core',[
|
|
5054
5150
|
self.$container.addClass('select2-container--disabled');
|
5055
5151
|
});
|
5056
5152
|
|
5057
|
-
this.on('focus', function () {
|
5058
|
-
self.$container.addClass('select2-container--focus');
|
5059
|
-
});
|
5060
|
-
|
5061
5153
|
this.on('blur', function () {
|
5062
5154
|
self.$container.removeClass('select2-container--focus');
|
5063
5155
|
});
|
5064
5156
|
|
5065
5157
|
this.on('query', function (params) {
|
5066
5158
|
if (!self.isOpen()) {
|
5067
|
-
self.trigger('open');
|
5159
|
+
self.trigger('open', {});
|
5068
5160
|
}
|
5069
5161
|
|
5070
5162
|
this.dataAdapter.query(params, function (data) {
|
@@ -5088,30 +5180,31 @@ S2.define('select2/core',[
|
|
5088
5180
|
var key = evt.which;
|
5089
5181
|
|
5090
5182
|
if (self.isOpen()) {
|
5091
|
-
if (key === KEYS.
|
5092
|
-
|
5183
|
+
if (key === KEYS.ESC || key === KEYS.TAB ||
|
5184
|
+
(key === KEYS.UP && evt.altKey)) {
|
5185
|
+
self.close();
|
5186
|
+
|
5187
|
+
evt.preventDefault();
|
5188
|
+
} else if (key === KEYS.ENTER) {
|
5189
|
+
self.trigger('results:select', {});
|
5093
5190
|
|
5094
5191
|
evt.preventDefault();
|
5095
5192
|
} else if ((key === KEYS.SPACE && evt.ctrlKey)) {
|
5096
|
-
self.trigger('results:toggle');
|
5193
|
+
self.trigger('results:toggle', {});
|
5097
5194
|
|
5098
5195
|
evt.preventDefault();
|
5099
5196
|
} else if (key === KEYS.UP) {
|
5100
|
-
self.trigger('results:previous');
|
5197
|
+
self.trigger('results:previous', {});
|
5101
5198
|
|
5102
5199
|
evt.preventDefault();
|
5103
5200
|
} else if (key === KEYS.DOWN) {
|
5104
|
-
self.trigger('results:next');
|
5105
|
-
|
5106
|
-
evt.preventDefault();
|
5107
|
-
} else if (key === KEYS.ESC || key === KEYS.TAB) {
|
5108
|
-
self.close();
|
5201
|
+
self.trigger('results:next', {});
|
5109
5202
|
|
5110
5203
|
evt.preventDefault();
|
5111
5204
|
}
|
5112
5205
|
} else {
|
5113
5206
|
if (key === KEYS.ENTER || key === KEYS.SPACE ||
|
5114
|
-
(
|
5207
|
+
(key === KEYS.DOWN && evt.altKey)) {
|
5115
5208
|
self.open();
|
5116
5209
|
|
5117
5210
|
evt.preventDefault();
|
@@ -5128,9 +5221,9 @@ S2.define('select2/core',[
|
|
5128
5221
|
this.close();
|
5129
5222
|
}
|
5130
5223
|
|
5131
|
-
this.trigger('disable');
|
5224
|
+
this.trigger('disable', {});
|
5132
5225
|
} else {
|
5133
|
-
this.trigger('enable');
|
5226
|
+
this.trigger('enable', {});
|
5134
5227
|
}
|
5135
5228
|
};
|
5136
5229
|
|
@@ -5185,8 +5278,6 @@ S2.define('select2/core',[
|
|
5185
5278
|
}
|
5186
5279
|
|
5187
5280
|
this.trigger('query', {});
|
5188
|
-
|
5189
|
-
this.trigger('open');
|
5190
5281
|
};
|
5191
5282
|
|
5192
5283
|
Select2.prototype.close = function () {
|
@@ -5194,13 +5285,27 @@ S2.define('select2/core',[
|
|
5194
5285
|
return;
|
5195
5286
|
}
|
5196
5287
|
|
5197
|
-
this.trigger('close');
|
5288
|
+
this.trigger('close', {});
|
5198
5289
|
};
|
5199
5290
|
|
5200
5291
|
Select2.prototype.isOpen = function () {
|
5201
5292
|
return this.$container.hasClass('select2-container--open');
|
5202
5293
|
};
|
5203
5294
|
|
5295
|
+
Select2.prototype.hasFocus = function () {
|
5296
|
+
return this.$container.hasClass('select2-container--focus');
|
5297
|
+
};
|
5298
|
+
|
5299
|
+
Select2.prototype.focus = function (data) {
|
5300
|
+
// No need to re-trigger focus events if we are already focused
|
5301
|
+
if (this.hasFocus()) {
|
5302
|
+
return;
|
5303
|
+
}
|
5304
|
+
|
5305
|
+
this.$container.addClass('select2-container--focus');
|
5306
|
+
this.trigger('focus', {});
|
5307
|
+
};
|
5308
|
+
|
5204
5309
|
Select2.prototype.enable = function (args) {
|
5205
5310
|
if (this.options.get('debug') && window.console && console.warn) {
|
5206
5311
|
console.warn(
|
@@ -5281,7 +5386,7 @@ S2.define('select2/core',[
|
|
5281
5386
|
this.$element.attr('tabindex', this.$element.data('old-tabindex'));
|
5282
5387
|
|
5283
5388
|
this.$element.removeClass('select2-hidden-accessible');
|
5284
|
-
|
5389
|
+
this.$element.attr('aria-hidden', 'false');
|
5285
5390
|
this.$element.removeData('select2');
|
5286
5391
|
|
5287
5392
|
this.dataAdapter.destroy();
|
@@ -10,3 +10,12 @@
|
|
10
10
|
right: 10px;
|
11
11
|
margin-top: -1px;
|
12
12
|
}
|
13
|
+
|
14
|
+
.select2-container--focus:not(.select2-container--open) {
|
15
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
|
16
|
+
outline: 0 none;
|
17
|
+
}
|
18
|
+
|
19
|
+
.select2-container--focus > .selection > .select2-selection {
|
20
|
+
border: 1px solid #9cd5fe !important;
|
21
|
+
}
|
@@ -40,7 +40,8 @@
|
|
40
40
|
box-sizing: border-box;
|
41
41
|
border: none;
|
42
42
|
font-size: 100%;
|
43
|
-
margin-top: 5px;
|
43
|
+
margin-top: 5px;
|
44
|
+
padding: 0; }
|
44
45
|
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
45
46
|
-webkit-appearance: none; }
|
46
47
|
|
@@ -113,14 +114,14 @@
|
|
113
114
|
filter: alpha(opacity=0); }
|
114
115
|
|
115
116
|
.select2-hidden-accessible {
|
116
|
-
border: 0;
|
117
|
-
clip: rect(0 0 0 0);
|
118
|
-
height: 1px;
|
119
|
-
margin: -1px;
|
120
|
-
overflow: hidden;
|
121
|
-
padding: 0;
|
122
|
-
position: absolute;
|
123
|
-
width: 1px; }
|
117
|
+
border: 0 !important;
|
118
|
+
clip: rect(0 0 0 0) !important;
|
119
|
+
height: 1px !important;
|
120
|
+
margin: -1px !important;
|
121
|
+
overflow: hidden !important;
|
122
|
+
padding: 0 !important;
|
123
|
+
position: absolute !important;
|
124
|
+
width: 1px !important; }
|
124
125
|
|
125
126
|
.select2-container--default .select2-selection--single {
|
126
127
|
background-color: #fff;
|
@@ -152,19 +153,24 @@
|
|
152
153
|
position: absolute;
|
153
154
|
top: 50%;
|
154
155
|
width: 0; }
|
156
|
+
|
155
157
|
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
156
158
|
float: left; }
|
159
|
+
|
157
160
|
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
158
161
|
left: 1px;
|
159
162
|
right: auto; }
|
163
|
+
|
160
164
|
.select2-container--default.select2-container--disabled .select2-selection--single {
|
161
165
|
background-color: #eee;
|
162
166
|
cursor: default; }
|
163
167
|
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
164
168
|
display: none; }
|
169
|
+
|
165
170
|
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
166
171
|
border-color: transparent transparent #888 transparent;
|
167
172
|
border-width: 0 4px 5px 4px; }
|
173
|
+
|
168
174
|
.select2-container--default .select2-selection--multiple {
|
169
175
|
background-color: white;
|
170
176
|
border: 1px solid #aaa;
|
@@ -203,43 +209,59 @@
|
|
203
209
|
margin-right: 2px; }
|
204
210
|
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
205
211
|
color: #333; }
|
206
|
-
|
212
|
+
|
213
|
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
207
214
|
float: right; }
|
215
|
+
|
208
216
|
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
209
217
|
margin-left: 5px;
|
210
218
|
margin-right: auto; }
|
219
|
+
|
211
220
|
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
212
221
|
margin-left: 2px;
|
213
222
|
margin-right: auto; }
|
223
|
+
|
214
224
|
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
215
225
|
border: solid black 1px;
|
216
226
|
outline: 0; }
|
227
|
+
|
217
228
|
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
218
229
|
background-color: #eee;
|
219
230
|
cursor: default; }
|
231
|
+
|
220
232
|
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
221
233
|
display: none; }
|
234
|
+
|
222
235
|
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
223
236
|
border-top-left-radius: 0;
|
224
237
|
border-top-right-radius: 0; }
|
238
|
+
|
225
239
|
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
226
240
|
border-bottom-left-radius: 0;
|
227
241
|
border-bottom-right-radius: 0; }
|
242
|
+
|
228
243
|
.select2-container--default .select2-search--dropdown .select2-search__field {
|
229
244
|
border: 1px solid #aaa; }
|
245
|
+
|
230
246
|
.select2-container--default .select2-search--inline .select2-search__field {
|
231
247
|
background: transparent;
|
232
248
|
border: none;
|
233
|
-
outline: 0;
|
249
|
+
outline: 0;
|
250
|
+
box-shadow: none; }
|
251
|
+
|
234
252
|
.select2-container--default .select2-results > .select2-results__options {
|
235
253
|
max-height: 200px;
|
236
254
|
overflow-y: auto; }
|
255
|
+
|
237
256
|
.select2-container--default .select2-results__option[role=group] {
|
238
257
|
padding: 0; }
|
258
|
+
|
239
259
|
.select2-container--default .select2-results__option[aria-disabled=true] {
|
240
260
|
color: #999; }
|
261
|
+
|
241
262
|
.select2-container--default .select2-results__option[aria-selected=true] {
|
242
263
|
background-color: #ddd; }
|
264
|
+
|
243
265
|
.select2-container--default .select2-results__option .select2-results__option {
|
244
266
|
padding-left: 1em; }
|
245
267
|
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
@@ -259,24 +281,26 @@
|
|
259
281
|
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
260
282
|
margin-left: -5em;
|
261
283
|
padding-left: 6em; }
|
284
|
+
|
262
285
|
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
263
286
|
background-color: #5897fb;
|
264
287
|
color: white; }
|
288
|
+
|
265
289
|
.select2-container--default .select2-results__group {
|
266
290
|
cursor: default;
|
267
291
|
display: block;
|
268
292
|
padding: 6px; }
|
269
293
|
|
270
294
|
.select2-container--classic .select2-selection--single {
|
271
|
-
background-color: #
|
295
|
+
background-color: #f7f7f7;
|
272
296
|
border: 1px solid #aaa;
|
273
297
|
border-radius: 4px;
|
274
298
|
outline: 0;
|
275
|
-
background-image: -webkit-linear-gradient(top,
|
276
|
-
background-image: -o-linear-gradient(top,
|
277
|
-
background-image: linear-gradient(to bottom,
|
299
|
+
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
300
|
+
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
301
|
+
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
278
302
|
background-repeat: repeat-x;
|
279
|
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#
|
303
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
280
304
|
.select2-container--classic .select2-selection--single:focus {
|
281
305
|
border: 1px solid #5897fb; }
|
282
306
|
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
@@ -304,7 +328,7 @@
|
|
304
328
|
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
305
329
|
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
306
330
|
background-repeat: repeat-x;
|
307
|
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#
|
331
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
308
332
|
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
309
333
|
border-color: #888 transparent transparent transparent;
|
310
334
|
border-style: solid;
|
@@ -316,8 +340,10 @@
|
|
316
340
|
position: absolute;
|
317
341
|
top: 50%;
|
318
342
|
width: 0; }
|
343
|
+
|
319
344
|
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
320
345
|
float: left; }
|
346
|
+
|
321
347
|
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
322
348
|
border: none;
|
323
349
|
border-right: 1px solid #aaa;
|
@@ -326,6 +352,7 @@
|
|
326
352
|
border-bottom-left-radius: 4px;
|
327
353
|
left: 1px;
|
328
354
|
right: auto; }
|
355
|
+
|
329
356
|
.select2-container--classic.select2-container--open .select2-selection--single {
|
330
357
|
border: 1px solid #5897fb; }
|
331
358
|
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
@@ -334,24 +361,27 @@
|
|
334
361
|
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
335
362
|
border-color: transparent transparent #888 transparent;
|
336
363
|
border-width: 0 4px 5px 4px; }
|
364
|
+
|
337
365
|
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
338
366
|
border-top: none;
|
339
367
|
border-top-left-radius: 0;
|
340
368
|
border-top-right-radius: 0;
|
341
|
-
background-image: -webkit-linear-gradient(top,
|
342
|
-
background-image: -o-linear-gradient(top,
|
343
|
-
background-image: linear-gradient(to bottom,
|
369
|
+
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
370
|
+
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
371
|
+
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
344
372
|
background-repeat: repeat-x;
|
345
|
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#
|
373
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
374
|
+
|
346
375
|
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
347
376
|
border-bottom: none;
|
348
377
|
border-bottom-left-radius: 0;
|
349
378
|
border-bottom-right-radius: 0;
|
350
|
-
background-image: -webkit-linear-gradient(top, #eeeeee 50%,
|
351
|
-
background-image: -o-linear-gradient(top, #eeeeee 50%,
|
352
|
-
background-image: linear-gradient(to bottom, #eeeeee 50%,
|
379
|
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
380
|
+
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
381
|
+
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
353
382
|
background-repeat: repeat-x;
|
354
|
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#
|
383
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
384
|
+
|
355
385
|
.select2-container--classic .select2-selection--multiple {
|
356
386
|
background-color: white;
|
357
387
|
border: 1px solid #aaa;
|
@@ -383,49 +413,67 @@
|
|
383
413
|
margin-right: 2px; }
|
384
414
|
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
385
415
|
color: #555; }
|
416
|
+
|
386
417
|
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
387
418
|
float: right; }
|
419
|
+
|
388
420
|
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
389
421
|
margin-left: 5px;
|
390
422
|
margin-right: auto; }
|
423
|
+
|
391
424
|
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
392
425
|
margin-left: 2px;
|
393
426
|
margin-right: auto; }
|
427
|
+
|
394
428
|
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
395
429
|
border: 1px solid #5897fb; }
|
430
|
+
|
396
431
|
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
397
432
|
border-top: none;
|
398
433
|
border-top-left-radius: 0;
|
399
434
|
border-top-right-radius: 0; }
|
435
|
+
|
400
436
|
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
401
437
|
border-bottom: none;
|
402
438
|
border-bottom-left-radius: 0;
|
403
439
|
border-bottom-right-radius: 0; }
|
440
|
+
|
404
441
|
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
405
442
|
border: 1px solid #aaa;
|
406
443
|
outline: 0; }
|
444
|
+
|
407
445
|
.select2-container--classic .select2-search--inline .select2-search__field {
|
408
|
-
outline: 0;
|
446
|
+
outline: 0;
|
447
|
+
box-shadow: none; }
|
448
|
+
|
409
449
|
.select2-container--classic .select2-dropdown {
|
410
450
|
background-color: white;
|
411
451
|
border: 1px solid transparent; }
|
452
|
+
|
412
453
|
.select2-container--classic .select2-dropdown--above {
|
413
454
|
border-bottom: none; }
|
455
|
+
|
414
456
|
.select2-container--classic .select2-dropdown--below {
|
415
457
|
border-top: none; }
|
458
|
+
|
416
459
|
.select2-container--classic .select2-results > .select2-results__options {
|
417
460
|
max-height: 200px;
|
418
461
|
overflow-y: auto; }
|
462
|
+
|
419
463
|
.select2-container--classic .select2-results__option[role=group] {
|
420
464
|
padding: 0; }
|
465
|
+
|
421
466
|
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
422
467
|
color: grey; }
|
468
|
+
|
423
469
|
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
424
470
|
background-color: #3875d7;
|
425
471
|
color: white; }
|
472
|
+
|
426
473
|
.select2-container--classic .select2-results__group {
|
427
474
|
cursor: default;
|
428
475
|
display: block;
|
429
476
|
padding: 6px; }
|
477
|
+
|
430
478
|
.select2-container--classic.select2-container--open .select2-dropdown {
|
431
479
|
border-color: #5897fb; }
|
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.7.
|
4
|
+
version: 0.7.1
|
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-08-
|
11
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|