select2-rails 3.5.5 → 3.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +1 -1
- data/app/assets/javascripts/select2.js +129 -78
- data/app/assets/javascripts/select2_locale_ar.js +3 -3
- data/app/assets/javascripts/select2_locale_fr.js +3 -2
- data/app/assets/javascripts/select2_locale_ka.js +17 -0
- data/app/assets/javascripts/select2_locale_pt-BR.js +2 -2
- data/app/assets/javascripts/select2_locale_uk.js +5 -4
- data/app/assets/stylesheets/select2.css.erb +9 -9
- data/lib/select2-rails/source_file.rb +1 -1
- data/lib/select2-rails/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjBiOTk1MWJlOTkyZmQ4MWE3OTQ3ZGFmMTYyMjA0NTY5MmIxNmU0NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGU5OGUwYTUxMTY5YWU3OTkzMWYyNmFiZTdkM2JlMzA0ODZiMGQzYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjY0OWJlNmIzNTU0M2Q2MWE4MWE1YmIwMjYwODIzNWEyNjI5MGIwMzQ4ZGIy
|
10
|
+
NWUxMjM1MmUwMjYxODhjNWEyYzAyZWE5MzJmMDEyMzUzMDdhMzRhZjIwOThm
|
11
|
+
ZGMxYWJkNTI1NjgyMmI1ZDFlNDUyMzhhN2Y4MzM3M2E2YzM1OTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjliNjcxYTI1MzdiYzI0MTgyMjJmNWVkMjg0NDRkYWY1YjE5MjE3NzI5ZjU1
|
14
|
+
ZTBlMTg5MjI3Y2RmYmIxNGM0MzE4MzIzM2YyYzgyYTQ0NTdlNDk0YTEwMjhm
|
15
|
+
YjNkMDZiN2VhZGY2ZWM1YWIxODAwM2RkMWI1OTA0MmI1OTA5MjA=
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ Add the following to your `app/assets/javascripts/application.js`:
|
|
40
40
|
|
41
41
|
Possible languages:
|
42
42
|
|
43
|
-
ar, ca, cs, da, de, el, es, et, eu, fi, fr, gl, he, hr, hu, id, is, it, ja, ko, lt, lv, mk, ms, nl, no, pl, pt-BR, pt-PT, ro, rs, ru, sk, sv, tr, uk, vi, zh-CN, zh-TW
|
43
|
+
ar, ca, cs, da, de, el, es, et, eu, fi, fr, gl, he, hr, hu, id, is, it, ja, ka, ko, lt, lv, mk, ms, nl, no, pl, pt-BR, pt-PT, ro, rs, ru, sk, sv, tr, uk, vi, zh-CN, zh-TW
|
44
44
|
|
45
45
|
## Example
|
46
46
|
Code [here](https://github.com/argerim/select_2_example)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
Copyright 2012 Igor Vaynberg
|
3
3
|
|
4
|
-
Version: 3.4.
|
4
|
+
Version: 3.4.7 Timestamp: Wed Apr 30 19:28:03 EDT 2014
|
5
5
|
|
6
6
|
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
|
7
7
|
General Public License version 2 (the "GPL License"). You may choose either license to govern your
|
@@ -114,16 +114,12 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
114
114
|
}
|
115
115
|
|
116
116
|
function stripDiacritics(str) {
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
ret = "";
|
122
|
-
for (i = 0, l = str.length; i < l; i++) {
|
123
|
-
c = str.charAt(i);
|
124
|
-
ret += DIACRITICS[c] || c;
|
117
|
+
// Used 'uni range + named function' from http://jsperf.com/diacritics/18
|
118
|
+
function match(a) {
|
119
|
+
return DIACRITICS[a] || a;
|
125
120
|
}
|
126
|
-
|
121
|
+
|
122
|
+
return str.replace(/[^\u0000-\u007E]/g, match);
|
127
123
|
}
|
128
124
|
|
129
125
|
function indexOf(value, array) {
|
@@ -238,20 +234,6 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
238
234
|
};
|
239
235
|
}
|
240
236
|
|
241
|
-
/**
|
242
|
-
* A simple implementation of a thunk
|
243
|
-
* @param formula function used to lazily initialize the thunk
|
244
|
-
* @return {Function}
|
245
|
-
*/
|
246
|
-
function thunk(formula) {
|
247
|
-
var evaluated = false,
|
248
|
-
value;
|
249
|
-
return function() {
|
250
|
-
if (evaluated === false) { value = formula(); evaluated = true; }
|
251
|
-
return value;
|
252
|
-
};
|
253
|
-
};
|
254
|
-
|
255
237
|
function installDebouncedScroll(threshold, element) {
|
256
238
|
var notify = debounce(threshold, function (e) { element.trigger("scroll-debounced", e);});
|
257
239
|
element.on("scroll", function (e) {
|
@@ -473,7 +455,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
473
455
|
*
|
474
456
|
* If the array form is used it is assumed that it contains objects with 'id' and 'text' keys.
|
475
457
|
*
|
476
|
-
* If the object form is used
|
458
|
+
* If the object form is used it is assumed that it contains 'data' and 'text' keys. The 'data' key should contain
|
477
459
|
* an array of objects that will be used as choices. These objects must contain at least an 'id' key. The 'text'
|
478
460
|
* key can either be a String in which case it is expected that each element in the 'data' array has a key with the
|
479
461
|
* value of 'text' which will be used to match choices. Alternatively, text can be a function(item) that can extract
|
@@ -542,14 +524,17 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
542
524
|
var isFunc = $.isFunction(data);
|
543
525
|
return function (query) {
|
544
526
|
var t = query.term, filtered = {results: []};
|
545
|
-
$(isFunc ? data() : data)
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
527
|
+
var result = $(isFunc ? data(query) : data);
|
528
|
+
if ($.isArray(result)) {
|
529
|
+
$(isFunc ? data() : data).each(function () {
|
530
|
+
var isObject = this.text !== undefined,
|
531
|
+
text = isObject ? this.text : this;
|
532
|
+
if (t === "" || query.matcher(t, text)) {
|
533
|
+
filtered.results.push(isObject ? this : {id: this, text: this});
|
534
|
+
}
|
535
|
+
});
|
536
|
+
query.callback(filtered);
|
537
|
+
}
|
553
538
|
};
|
554
539
|
}
|
555
540
|
|
@@ -641,6 +626,15 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
641
626
|
if (original!==input) return input;
|
642
627
|
}
|
643
628
|
|
629
|
+
function cleanupJQueryElements() {
|
630
|
+
var self = this;
|
631
|
+
|
632
|
+
Array.prototype.forEach.call(arguments, function (element) {
|
633
|
+
self[element].remove();
|
634
|
+
self[element] = null;
|
635
|
+
});
|
636
|
+
}
|
637
|
+
|
644
638
|
/**
|
645
639
|
* Creates a new class
|
646
640
|
*
|
@@ -690,12 +684,15 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
690
684
|
.addClass("select2-hidden-accessible")
|
691
685
|
.appendTo(document.body);
|
692
686
|
|
693
|
-
this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid())
|
694
|
-
this.
|
687
|
+
this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
|
688
|
+
this.containerEventName= this.containerId
|
689
|
+
.replace(/([.])/g, '_')
|
690
|
+
.replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
|
695
691
|
this.container.attr("id", this.containerId);
|
696
692
|
|
697
|
-
|
698
|
-
|
693
|
+
this.container.attr("title", opts.element.attr("title"));
|
694
|
+
|
695
|
+
this.body = $("body");
|
699
696
|
|
700
697
|
syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
|
701
698
|
|
@@ -735,11 +732,24 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
735
732
|
this.container.on("click", killEvent);
|
736
733
|
|
737
734
|
installFilteredMouseMove(this.results);
|
738
|
-
|
739
|
-
this.dropdown.on("
|
735
|
+
|
736
|
+
this.dropdown.on("mousemove-filtered", resultsSelector, this.bind(this.highlightUnderEvent));
|
737
|
+
this.dropdown.on("touchstart touchmove touchend", resultsSelector, this.bind(function (event) {
|
738
|
+
this._touchEvent = true;
|
739
|
+
this.highlightUnderEvent(event);
|
740
|
+
}));
|
740
741
|
this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
|
741
742
|
this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
|
742
743
|
|
744
|
+
// Waiting for a click event on touch devices to select option and hide dropdown
|
745
|
+
// otherwise click will be triggered on an underlying element
|
746
|
+
this.dropdown.on('click', this.bind(function (event) {
|
747
|
+
if (this._touchEvent) {
|
748
|
+
this._touchEvent = false;
|
749
|
+
this.selectHighlighted();
|
750
|
+
}
|
751
|
+
}));
|
752
|
+
|
743
753
|
installDebouncedScroll(80, this.results);
|
744
754
|
this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
|
745
755
|
|
@@ -777,7 +787,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
777
787
|
// for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
|
778
788
|
// dom it will trigger the popup close, which is not what we want
|
779
789
|
// focusin can cause focus wars between modals and select2 since the dropdown is outside the modal.
|
780
|
-
this.dropdown.on("click mouseup mousedown focusin", function (e) { e.stopPropagation(); });
|
790
|
+
this.dropdown.on("click mouseup mousedown touchstart touchend focusin", function (e) { e.stopPropagation(); });
|
781
791
|
|
782
792
|
this.nextSearchTerm = undefined;
|
783
793
|
|
@@ -818,7 +828,10 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
818
828
|
|
819
829
|
this.close();
|
820
830
|
|
821
|
-
if (this.propertyObserver) {
|
831
|
+
if (this.propertyObserver) {
|
832
|
+
this.propertyObserver.disconnect();
|
833
|
+
this.propertyObserver = null;
|
834
|
+
}
|
822
835
|
|
823
836
|
if (select2 !== undefined) {
|
824
837
|
select2.container.remove();
|
@@ -836,6 +849,14 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
836
849
|
}
|
837
850
|
element.show();
|
838
851
|
}
|
852
|
+
|
853
|
+
cleanupJQueryElements.call(this,
|
854
|
+
"container",
|
855
|
+
"liveRegion",
|
856
|
+
"dropdown",
|
857
|
+
"results",
|
858
|
+
"search"
|
859
|
+
);
|
839
860
|
},
|
840
861
|
|
841
862
|
// abstract
|
@@ -1068,21 +1089,20 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1068
1089
|
|
1069
1090
|
});
|
1070
1091
|
|
1071
|
-
// IE8-10
|
1072
|
-
el.
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
this.mutationCallback = function (mutations) {
|
1077
|
-
mutations.forEach(sync);
|
1078
|
-
}
|
1092
|
+
// IE8-10 (IE9/10 won't fire propertyChange via attachEventListener)
|
1093
|
+
if (el.length && el[0].attachEvent) {
|
1094
|
+
el.each(function() {
|
1095
|
+
this.attachEvent("onpropertychange", sync);
|
1096
|
+
});
|
1079
1097
|
}
|
1080
|
-
|
1098
|
+
|
1081
1099
|
// safari, chrome, firefox, IE11
|
1082
1100
|
observer = window.MutationObserver || window.WebKitMutationObserver|| window.MozMutationObserver;
|
1083
1101
|
if (observer !== undefined) {
|
1084
1102
|
if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
|
1085
|
-
this.propertyObserver = new observer(
|
1103
|
+
this.propertyObserver = new observer(function (mutations) {
|
1104
|
+
mutations.forEach(sync);
|
1105
|
+
});
|
1086
1106
|
this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
|
1087
1107
|
}
|
1088
1108
|
},
|
@@ -1221,6 +1241,9 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1221
1241
|
dropWidth = $dropdown.outerWidth(false);
|
1222
1242
|
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight;
|
1223
1243
|
$dropdown.show();
|
1244
|
+
|
1245
|
+
// fix so the cursor does not move to the left within the search-textbox in IE
|
1246
|
+
this.focusSearch();
|
1224
1247
|
}
|
1225
1248
|
|
1226
1249
|
if (this.opts.dropdownAutoWidth) {
|
@@ -1230,6 +1253,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1230
1253
|
// Add scrollbar width to dropdown if vertical scrollbar is present
|
1231
1254
|
dropWidth = $dropdown.outerWidth(false) + (resultsListNode.scrollHeight === resultsListNode.clientHeight ? 0 : scrollBarDimensions.width);
|
1232
1255
|
dropWidth > width ? width = dropWidth : dropWidth = width;
|
1256
|
+
dropHeight = $dropdown.outerHeight(false);
|
1233
1257
|
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight;
|
1234
1258
|
}
|
1235
1259
|
else {
|
@@ -1237,11 +1261,11 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1237
1261
|
}
|
1238
1262
|
|
1239
1263
|
//console.log("below/ droptop:", dropTop, "dropHeight", dropHeight, "sum", (dropTop+dropHeight)+" viewport bottom", viewportBottom, "enough?", enoughRoomBelow);
|
1240
|
-
//console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body
|
1264
|
+
//console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body.scrollTop(), "enough?", enoughRoomAbove);
|
1241
1265
|
|
1242
1266
|
// fix positioning when body has an offset and is not position: static
|
1243
|
-
if (this.body
|
1244
|
-
bodyOffset = this.body
|
1267
|
+
if (this.body.css('position') !== 'static') {
|
1268
|
+
bodyOffset = this.body.offset();
|
1245
1269
|
dropTop -= bodyOffset.top;
|
1246
1270
|
dropLeft -= bodyOffset.left;
|
1247
1271
|
}
|
@@ -1313,7 +1337,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1313
1337
|
*/
|
1314
1338
|
// abstract
|
1315
1339
|
opening: function() {
|
1316
|
-
var cid = this.
|
1340
|
+
var cid = this.containerEventName,
|
1317
1341
|
scroll = "scroll." + cid,
|
1318
1342
|
resize = "resize."+cid,
|
1319
1343
|
orient = "orientationchange."+cid,
|
@@ -1323,8 +1347,8 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1323
1347
|
|
1324
1348
|
this.clearDropdownAlignmentPreference();
|
1325
1349
|
|
1326
|
-
if(this.dropdown[0] !== this.body
|
1327
|
-
this.dropdown.detach().appendTo(this.body
|
1350
|
+
if(this.dropdown[0] !== this.body.children().last()[0]) {
|
1351
|
+
this.dropdown.detach().appendTo(this.body);
|
1328
1352
|
}
|
1329
1353
|
|
1330
1354
|
// create the dropdown mask if doesn't already exist
|
@@ -1333,7 +1357,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1333
1357
|
mask = $(document.createElement("div"));
|
1334
1358
|
mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask");
|
1335
1359
|
mask.hide();
|
1336
|
-
mask.appendTo(this.body
|
1360
|
+
mask.appendTo(this.body);
|
1337
1361
|
mask.on("mousedown touchstart click", function (e) {
|
1338
1362
|
// Prevent IE from generating a click event on the body
|
1339
1363
|
reinsertElement(mask);
|
@@ -1374,7 +1398,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1374
1398
|
var that = this;
|
1375
1399
|
this.container.parents().add(window).each(function () {
|
1376
1400
|
$(this).on(resize+" "+scroll+" "+orient, function (e) {
|
1377
|
-
that.positionDropdown();
|
1401
|
+
if (that.opened()) that.positionDropdown();
|
1378
1402
|
});
|
1379
1403
|
});
|
1380
1404
|
|
@@ -1385,7 +1409,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1385
1409
|
close: function () {
|
1386
1410
|
if (!this.opened()) return;
|
1387
1411
|
|
1388
|
-
var cid = this.
|
1412
|
+
var cid = this.containerEventName,
|
1389
1413
|
scroll = "scroll." + cid,
|
1390
1414
|
resize = "resize."+cid,
|
1391
1415
|
orient = "orientationchange."+cid;
|
@@ -1806,7 +1830,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1806
1830
|
//Determine the placeholder option based on the specified placeholderOption setting
|
1807
1831
|
return (this.opts.placeholderOption === "first" && firstOption) ||
|
1808
1832
|
(typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
|
1809
|
-
} else if (firstOption.text() === "" && firstOption.val() === "") {
|
1833
|
+
} else if ($.trim(firstOption.text()) === "" && firstOption.val() === "") {
|
1810
1834
|
//No explicit placeholder option specified, use the first if it's blank
|
1811
1835
|
return firstOption;
|
1812
1836
|
}
|
@@ -1875,7 +1899,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1875
1899
|
"class": "select2-container"
|
1876
1900
|
}).html([
|
1877
1901
|
"<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>",
|
1878
|
-
" <span class='select2-chosen'
|
1902
|
+
" <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>",
|
1879
1903
|
" <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>",
|
1880
1904
|
"</a>",
|
1881
1905
|
"<label for='' class='select2-offscreen'></label>",
|
@@ -1915,17 +1939,19 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1915
1939
|
|
1916
1940
|
this.search.val(this.focusser.val());
|
1917
1941
|
}
|
1918
|
-
this.
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1942
|
+
if (this.opts.shouldFocusInput(this)) {
|
1943
|
+
this.search.focus();
|
1944
|
+
// move the cursor to the end after focussing, otherwise it will be at the beginning and
|
1945
|
+
// new text will appear *before* focusser.val()
|
1946
|
+
el = this.search.get(0);
|
1947
|
+
if (el.createTextRange) {
|
1948
|
+
range = el.createTextRange();
|
1949
|
+
range.collapse(false);
|
1950
|
+
range.select();
|
1951
|
+
} else if (el.setSelectionRange) {
|
1952
|
+
len = this.search.val().length;
|
1953
|
+
el.setSelectionRange(len, len);
|
1954
|
+
}
|
1929
1955
|
}
|
1930
1956
|
|
1931
1957
|
// initializes search's value with nextSearchTerm (if defined by user)
|
@@ -1986,6 +2012,11 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1986
2012
|
$("label[for='" + this.focusser.attr('id') + "']")
|
1987
2013
|
.attr('for', this.opts.element.attr("id"));
|
1988
2014
|
this.parent.destroy.apply(this, arguments);
|
2015
|
+
|
2016
|
+
cleanupJQueryElements.call(this,
|
2017
|
+
"selection",
|
2018
|
+
"focusser"
|
2019
|
+
);
|
1989
2020
|
},
|
1990
2021
|
|
1991
2022
|
// single
|
@@ -2067,7 +2098,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2067
2098
|
this.search.on("blur", this.bind(function(e) {
|
2068
2099
|
// a workaround for chrome to keep the search field focussed when the scroll bar is used to scroll the dropdown.
|
2069
2100
|
// without this the search field loses focus which is annoying
|
2070
|
-
if (document.activeElement === this.body
|
2101
|
+
if (document.activeElement === this.body.get(0)) {
|
2071
2102
|
window.setTimeout(this.bind(function() {
|
2072
2103
|
if (this.opened()) {
|
2073
2104
|
this.search.focus();
|
@@ -2142,7 +2173,11 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2142
2173
|
killEvent(e);
|
2143
2174
|
}));
|
2144
2175
|
|
2145
|
-
dropdown.on("mousedown touchstart", this.bind(function() {
|
2176
|
+
dropdown.on("mousedown touchstart", this.bind(function() {
|
2177
|
+
if (this.opts.shouldFocusInput(this)) {
|
2178
|
+
this.search.focus();
|
2179
|
+
}
|
2180
|
+
}));
|
2146
2181
|
|
2147
2182
|
selection.on("focus", this.bind(function(e) {
|
2148
2183
|
killEvent(e);
|
@@ -2219,7 +2254,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2219
2254
|
|
2220
2255
|
isPlaceholderOptionSelected: function() {
|
2221
2256
|
var placeholderOption;
|
2222
|
-
if (
|
2257
|
+
if (this.getPlaceholder() === undefined) return false; // no placeholder specified so no option should be considered
|
2223
2258
|
return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.prop("selected"))
|
2224
2259
|
|| (this.opts.element.val() === "")
|
2225
2260
|
|| (this.opts.element.val() === undefined)
|
@@ -2572,6 +2607,11 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2572
2607
|
$("label[for='" + this.search.attr('id') + "']")
|
2573
2608
|
.attr('for', this.opts.element.attr("id"));
|
2574
2609
|
this.parent.destroy.apply(this, arguments);
|
2610
|
+
|
2611
|
+
cleanupJQueryElements.call(this,
|
2612
|
+
"searchContainer",
|
2613
|
+
"selection"
|
2614
|
+
);
|
2575
2615
|
},
|
2576
2616
|
|
2577
2617
|
// multi
|
@@ -2821,7 +2861,9 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2821
2861
|
}
|
2822
2862
|
|
2823
2863
|
this.updateResults(true);
|
2824
|
-
this.
|
2864
|
+
if (this.opts.shouldFocusInput(this)) {
|
2865
|
+
this.search.focus();
|
2866
|
+
}
|
2825
2867
|
this.opts.element.trigger($.Event("select2-open"));
|
2826
2868
|
},
|
2827
2869
|
|
@@ -3298,7 +3340,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3298
3340
|
value = select2[method].apply(select2, args.slice(1));
|
3299
3341
|
}
|
3300
3342
|
if (indexOf(args[0], valueMethods) >= 0
|
3301
|
-
|| (indexOf(args[0], propertyMethods) && args.length == 1)) {
|
3343
|
+
|| (indexOf(args[0], propertyMethods) >= 0 && args.length == 1)) {
|
3302
3344
|
return false; // abort the iteration, ready to return first matched value
|
3303
3345
|
}
|
3304
3346
|
} else {
|
@@ -3358,6 +3400,15 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3358
3400
|
searchInputPlaceholder: '',
|
3359
3401
|
createSearchChoicePosition: 'top',
|
3360
3402
|
shouldFocusInput: function (instance) {
|
3403
|
+
// Attempt to detect touch devices
|
3404
|
+
var supportsTouchEvents = (('ontouchstart' in window) ||
|
3405
|
+
(navigator.msMaxTouchPoints > 0));
|
3406
|
+
|
3407
|
+
// Only devices which support touch events should be special cased
|
3408
|
+
if (!supportsTouchEvents) {
|
3409
|
+
return true;
|
3410
|
+
}
|
3411
|
+
|
3361
3412
|
// Never focus the input if search is disabled
|
3362
3413
|
if (instance.opts.minimumResultsForSearch < 0) {
|
3363
3414
|
return false;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/**
|
1
|
+
/**
|
2
2
|
* Select2 Arabic translation.
|
3
3
|
*
|
4
4
|
* Author: Adel KEDJOUR <adel@kedjour.com>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
|
9
9
|
$.extend($.fn.select2.defaults, {
|
10
10
|
formatNoMatches: function () { return "لم يتم العثور على مطابقات"; },
|
11
|
-
formatInputTooShort: function (input, min) { var n = min - input.length; if (n == 1){ return "الرجاء إدخال حرف واحد على الأكثر"; } return n == 2 ? "الرجاء إدخال حرفين على الأكثر" : "
|
12
|
-
formatInputTooLong: function (input, max) { var n = input.length - max; if (n == 1){ return "الرجاء إدخال حرف واحد على الأقل"; } return n == 2 ? "الرجاء إدخال حرفين على الأقل" : "
|
11
|
+
formatInputTooShort: function (input, min) { var n = min - input.length; if (n == 1){ return "الرجاء إدخال حرف واحد على الأكثر"; } return n == 2 ? "الرجاء إدخال حرفين على الأكثر" : "الرجاء إدخال " + n + " على الأكثر"; },
|
12
|
+
formatInputTooLong: function (input, max) { var n = input.length - max; if (n == 1){ return "الرجاء إدخال حرف واحد على الأقل"; } return n == 2 ? "الرجاء إدخال حرفين على الأقل" : "الرجاء إدخال " + n + " على الأقل "; },
|
13
13
|
formatSelectionTooBig: function (limit) { if (n == 1){ return "يمكنك أن تختار إختيار واحد فقط"; } return n == 2 ? "يمكنك أن تختار إختيارين فقط" : "يمكنك أن تختار " + n + " إختيارات فقط"; },
|
14
14
|
formatLoadMore: function (pageNumber) { return "تحميل المزيد من النتائج…"; },
|
15
15
|
formatSearching: function () { return "البحث…"; }
|
@@ -5,9 +5,10 @@
|
|
5
5
|
"use strict";
|
6
6
|
|
7
7
|
$.extend($.fn.select2.defaults, {
|
8
|
+
formatMatches: function (matches) { return matches + " résultats sont disponibles, utilisez les flèches haut et bas pour naviguer."; },
|
8
9
|
formatNoMatches: function () { return "Aucun résultat trouvé"; },
|
9
|
-
formatInputTooShort: function (input, min) { var n = min - input.length; return "Merci de saisir " + n + " caractère" + (n == 1? "" : "s") + " de plus"; },
|
10
|
-
formatInputTooLong: function (input, max) { var n = input.length - max; return "Merci de supprimer " + n + " caractère" + (n == 1? "" : "s"); },
|
10
|
+
formatInputTooShort: function (input, min) { var n = min - input.length; return "Merci de saisir " + n + " caractère" + (n == 1 ? "" : "s") + " de plus"; },
|
11
|
+
formatInputTooLong: function (input, max) { var n = input.length - max; return "Merci de supprimer " + n + " caractère" + (n == 1 ? "" : "s"); },
|
11
12
|
formatSelectionTooBig: function (limit) { return "Vous pouvez seulement sélectionner " + limit + " élément" + (limit == 1 ? "" : "s"); },
|
12
13
|
formatLoadMore: function (pageNumber) { return "Chargement de résultats supplémentaires…"; },
|
13
14
|
formatSearching: function () { return "Recherche en cours…"; }
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* Select2 Georgian (Kartuli) translation.
|
3
|
+
*
|
4
|
+
* Author: Dimitri Kurashvili dimakura@gmail.com
|
5
|
+
*/
|
6
|
+
(function ($) {
|
7
|
+
"use strict";
|
8
|
+
|
9
|
+
$.extend($.fn.select2.defaults, {
|
10
|
+
formatNoMatches: function () { return "ვერ მოიძებნა"; },
|
11
|
+
formatInputTooShort: function (input, min) { var n = min - input.length; return "გთხოვთ შეიყვანოთ კიდევ " + n + " სიმბოლო"; },
|
12
|
+
formatInputTooLong: function (input, max) { var n = input.length - max; return "გთხოვთ წაშალოთ " + n + " სიმბოლო"; },
|
13
|
+
formatSelectionTooBig: function (limit) { return "თქვენ შეგიძლიათ მხოლოდ " + limit + " ჩანაწერის მონიშვნა"; },
|
14
|
+
formatLoadMore: function (pageNumber) { return "შედეგის ჩატვირთვა…"; },
|
15
|
+
formatSearching: function () { return "ძებნა…"; }
|
16
|
+
});
|
17
|
+
})(jQuery);
|
@@ -6,8 +6,8 @@
|
|
6
6
|
|
7
7
|
$.extend($.fn.select2.defaults, {
|
8
8
|
formatNoMatches: function () { return "Nenhum resultado encontrado"; },
|
9
|
-
formatInputTooShort: function (input, min) { var n = min - input.length; return "
|
10
|
-
formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + "
|
9
|
+
formatInputTooShort: function (input, min) { var n = min - input.length; return "Digite mais " + n + " caracter" + (n == 1? "" : "es"); },
|
10
|
+
formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " caracter" + (n == 1? "" : "es"); },
|
11
11
|
formatSelectionTooBig: function (limit) { return "Só é possível selecionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
|
12
12
|
formatLoadMore: function (pageNumber) { return "Carregando mais resultados…"; },
|
13
13
|
formatSearching: function () { return "Buscando…"; }
|
@@ -8,15 +8,16 @@
|
|
8
8
|
"use strict";
|
9
9
|
|
10
10
|
$.extend($.fn.select2.defaults, {
|
11
|
+
formatMatches: function (matches) { return character(matches, "результат") + " знайдено, використовуйте клавіші зі стрілками вверх та вниз для навігації."; },
|
11
12
|
formatNoMatches: function () { return "Нічого не знайдено"; },
|
12
|
-
formatInputTooShort: function (input, min) { return "Введіть буль ласка ще" + character(min - input.length, "символ"); },
|
13
|
-
formatInputTooLong: function (input, max) { return "Введіть буль ласка на" + character(input.length - max, "символ") + " менше"; },
|
14
|
-
formatSelectionTooBig: function (limit) { return "Ви можете вибрати лише" + character(limit, "елемент"); },
|
13
|
+
formatInputTooShort: function (input, min) { return "Введіть буль ласка ще " + character(min - input.length, "символ"); },
|
14
|
+
formatInputTooLong: function (input, max) { return "Введіть буль ласка на " + character(input.length - max, "символ") + " менше"; },
|
15
|
+
formatSelectionTooBig: function (limit) { return "Ви можете вибрати лише " + character(limit, "елемент"); },
|
15
16
|
formatLoadMore: function (pageNumber) { return "Завантаження даних…"; },
|
16
17
|
formatSearching: function () { return "Пошук…"; }
|
17
18
|
});
|
18
19
|
|
19
20
|
function character (n, word) {
|
20
|
-
return
|
21
|
+
return n + " " + word + (n%10 < 5 && n%10 > 0 && (n%100 < 5 || n%100 > 19) ? n%10 > 1 ? "и" : "" : "ів");
|
21
22
|
}
|
22
23
|
})(jQuery);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
//= depend_on_asset "select2-spinner.gif"
|
3
3
|
//= depend_on_asset "select2x2.png"
|
4
4
|
/*
|
5
|
-
Version: 3.4.
|
5
|
+
Version: 3.4.7 Timestamp: Wed Apr 30 19:28:03 EDT 2014
|
6
6
|
*/
|
7
7
|
.select2-container {
|
8
8
|
margin: 0;
|
@@ -329,14 +329,6 @@ Version: 3.4.6 Timestamp: Sat Mar 22 22:30:15 EDT 2014
|
|
329
329
|
padding-left: 0;
|
330
330
|
}
|
331
331
|
|
332
|
-
.select2-results ul.select2-result-sub > li .select2-result-label { padding-left: 20px }
|
333
|
-
.select2-results ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 40px }
|
334
|
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 60px }
|
335
|
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 80px }
|
336
|
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 100px }
|
337
|
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 110px }
|
338
|
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 120px }
|
339
|
-
|
340
332
|
.select2-results li {
|
341
333
|
list-style: none;
|
342
334
|
display: list-item;
|
@@ -361,6 +353,14 @@ Version: 3.4.6 Timestamp: Sat Mar 22 22:30:15 EDT 2014
|
|
361
353
|
user-select: none;
|
362
354
|
}
|
363
355
|
|
356
|
+
.select2-results-dept-1 .select2-result-label { padding-left: 20px }
|
357
|
+
.select2-results-dept-2 .select2-result-label { padding-left: 40px }
|
358
|
+
.select2-results-dept-3 .select2-result-label { padding-left: 60px }
|
359
|
+
.select2-results-dept-4 .select2-result-label { padding-left: 80px }
|
360
|
+
.select2-results-dept-5 .select2-result-label { padding-left: 100px }
|
361
|
+
.select2-results-dept-6 .select2-result-label { padding-left: 110px }
|
362
|
+
.select2-results-dept-7 .select2-result-label { padding-left: 120px }
|
363
|
+
|
364
364
|
.select2-results .select2-highlighted {
|
365
365
|
background: #3875d7;
|
366
366
|
color: #fff;
|
@@ -47,7 +47,7 @@ class SourceFile < Thor
|
|
47
47
|
end
|
48
48
|
def languages
|
49
49
|
[ "ar", "bg", "ca", "cs", "da", "de", "el", "es", "et", "eu", "fa", "fi", "fr", "gl", "he", "hr",
|
50
|
-
"hu", "id", "is", "it", "ja", "ko", "lt", "lv", "mk", "ms", "nl", "no", "pl", "pt-BR",
|
50
|
+
"hu", "id", "is", "it", "ja", "ka", "ko", "lt", "lv", "mk", "ms", "nl", "no", "pl", "pt-BR",
|
51
51
|
"pt-PT", "ro", "rs", "ru", "sk", "sv", "th", "tr", "uk", "vi", "zh-CN", "zh-TW"
|
52
52
|
].sort
|
53
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: select2-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rogerio Medeiros
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- app/assets/javascripts/select2_locale_is.js
|
107
107
|
- app/assets/javascripts/select2_locale_it.js
|
108
108
|
- app/assets/javascripts/select2_locale_ja.js
|
109
|
+
- app/assets/javascripts/select2_locale_ka.js
|
109
110
|
- app/assets/javascripts/select2_locale_ko.js
|
110
111
|
- app/assets/javascripts/select2_locale_lt.js
|
111
112
|
- app/assets/javascripts/select2_locale_lv.js
|