select2-rails 3.5.9.1 → 3.5.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +0 -1
- data/lib/select2-rails/source_file.rb +6 -5
- data/lib/select2-rails/version.rb +1 -1
- data/vendor/assets/javascripts/select2.js +82 -49
- data/vendor/assets/javascripts/select2_locale_ar.js +2 -2
- data/vendor/assets/javascripts/select2_locale_es.js +3 -1
- data/vendor/assets/javascripts/select2_locale_nb.js +22 -0
- data/vendor/assets/javascripts/select2_locale_pl.js +39 -10
- data/vendor/assets/javascripts/select2_locale_pt-BR.js +2 -1
- data/vendor/assets/javascripts/select2_locale_sk.js +2 -2
- data/vendor/assets/stylesheets/select2.scss +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23ee717502bbddfa524d6e1b8feb4eeab1bbb0bd
|
4
|
+
data.tar.gz: 1a8505a2592ac011b76175df0cf68d8b42d01bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e05909cd51a2b6d7ff33cf65bf9ff2f0c29a751714668a81f4bb5ee10e112114ff8511ff51e12e14cb0dac1bb5f33306cd58323fd23961f7df618c2beac5185a
|
7
|
+
data.tar.gz: 4370bbc8434351cc3f5ed11eb8ede012f980c20f2dfab44dd5a1ce578406f6869aa2f9c1261782db8d504c2f78b825417c995b3979e8e6370b387b77cc37fd1b
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#Select2 for rails asset pipeline
|
2
2
|
|
3
|
-
[Select2](https://github.com/
|
3
|
+
[Select2](https://github.com/select2/select2) is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
|
4
4
|
|
5
5
|
The `select2-rails` gem integrates the `Select2` jQuery plugin with the Rails asset pipeline.
|
6
6
|
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ class SourceFile < Thor
|
|
10
10
|
filtered_tags = fetch_tags
|
11
11
|
tag = select("Which tag do you want to fetch?", filtered_tags)
|
12
12
|
self.destination_root = "vendor/assets"
|
13
|
-
remote = "https://github.com/
|
13
|
+
remote = "https://github.com/select2/select2"
|
14
14
|
get "#{remote}/raw/#{tag}/select2.png", "images/select2.png"
|
15
15
|
get "#{remote}/raw/#{tag}/select2x2.png", "images/select2x2.png"
|
16
16
|
get "#{remote}/raw/#{tag}/select2-spinner.gif", "images/select2-spinner.gif"
|
@@ -34,14 +34,15 @@ class SourceFile < Thor
|
|
34
34
|
|
35
35
|
def fetch_tags
|
36
36
|
http = HTTPClient.new
|
37
|
-
|
37
|
+
#http.ssl_config.ssl_version = :SSLv23
|
38
|
+
response = JSON.parse(http.get("https://api.github.com/repos/select2/select2/tags").body)
|
38
39
|
response.map{|tag| tag["name"]}.sort
|
39
40
|
end
|
40
41
|
|
41
42
|
def languages
|
42
|
-
[ "ar", "bg", "ca", "cs", "da", "de", "el", "es", "et", "eu", "fa", "fi", "fr", "gl", "he", "hr",
|
43
|
-
"hu", "id", "is", "it", "ja", "ka", "ko", "lt", "lv", "mk", "ms", "
|
44
|
-
"pt-PT", "ro", "rs", "ru", "sk", "sv", "th", "tr", "uk", "vi", "zh-CN", "zh-TW"
|
43
|
+
[ "ar", "az", "bg", "ca", "cs", "da", "de", "el", "es", "et", "eu", "fa", "fi", "fr", "gl", "he", "hr",
|
44
|
+
"hu", "id", "is", "it", "ja", "ka", "ko", "lt", "lv", "mk", "ms", "nb", "nl", "pl", "pt-BR",
|
45
|
+
"pt-PT", "ro", "rs", "ru", "sk", "sv", "th", "tr", "ug-CN", "uk", "vi", "zh-CN", "zh-TW"
|
45
46
|
].sort
|
46
47
|
end
|
47
48
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
Copyright 2012 Igor Vaynberg
|
3
3
|
|
4
|
-
Version: 3.5.1
|
4
|
+
Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 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
|
@@ -46,7 +46,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
46
46
|
return;
|
47
47
|
}
|
48
48
|
|
49
|
-
var
|
49
|
+
var AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer,
|
50
50
|
lastMousePosition={x:0,y:0}, $document, scrollBarDimensions,
|
51
51
|
|
52
52
|
KEY = {
|
@@ -132,7 +132,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
132
132
|
|
133
133
|
function measureScrollbar () {
|
134
134
|
var $template = $( MEASURE_SCROLLBAR_TEMPLATE );
|
135
|
-
$template.appendTo(
|
135
|
+
$template.appendTo(document.body);
|
136
136
|
|
137
137
|
var dim = {
|
138
138
|
width: $template.width() - $template[0].clientWidth,
|
@@ -160,16 +160,16 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
160
160
|
}
|
161
161
|
|
162
162
|
/**
|
163
|
-
* Splits the string into an array of values,
|
163
|
+
* Splits the string into an array of values, transforming each value. An empty array is returned for nulls or empty
|
164
164
|
* strings
|
165
165
|
* @param string
|
166
166
|
* @param separator
|
167
167
|
*/
|
168
|
-
function splitVal(string, separator) {
|
168
|
+
function splitVal(string, separator, transform) {
|
169
169
|
var val, i, l;
|
170
170
|
if (string === null || string.length < 1) return [];
|
171
171
|
val = string.split(separator);
|
172
|
-
for (i = 0, l = val.length; i < l; i = i + 1) val[i] =
|
172
|
+
for (i = 0, l = val.length; i < l; i = i + 1) val[i] = transform(val[i]);
|
173
173
|
return val;
|
174
174
|
}
|
175
175
|
|
@@ -311,7 +311,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
311
311
|
whiteSpace: "nowrap"
|
312
312
|
});
|
313
313
|
sizer.attr("class","select2-sizer");
|
314
|
-
$(
|
314
|
+
$(document.body).append(sizer);
|
315
315
|
}
|
316
316
|
sizer.text(e.val());
|
317
317
|
return sizer.width();
|
@@ -450,7 +450,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
450
450
|
hasError: true,
|
451
451
|
jqXHR: jqXHR,
|
452
452
|
textStatus: textStatus,
|
453
|
-
errorThrown: errorThrown
|
453
|
+
errorThrown: errorThrown
|
454
454
|
};
|
455
455
|
|
456
456
|
query.callback(results);
|
@@ -699,12 +699,15 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
699
699
|
|
700
700
|
this.container = this.createContainer();
|
701
701
|
|
702
|
-
this.liveRegion = $(
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
702
|
+
this.liveRegion = $('.select2-hidden-accessible');
|
703
|
+
if (this.liveRegion.length == 0) {
|
704
|
+
this.liveRegion = $("<span>", {
|
705
|
+
role: "status",
|
706
|
+
"aria-live": "polite"
|
707
|
+
})
|
708
|
+
.addClass("select2-hidden-accessible")
|
709
|
+
.appendTo(document.body);
|
710
|
+
}
|
708
711
|
|
709
712
|
this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
|
710
713
|
this.containerEventName= this.containerId
|
@@ -714,7 +717,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
714
717
|
|
715
718
|
this.container.attr("title", opts.element.attr("title"));
|
716
719
|
|
717
|
-
this.body = $(
|
720
|
+
this.body = $(document.body);
|
718
721
|
|
719
722
|
syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
|
720
723
|
|
@@ -850,9 +853,11 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
850
853
|
|
851
854
|
this.close();
|
852
855
|
|
853
|
-
if (element.length && element[0].detachEvent) {
|
856
|
+
if (element.length && element[0].detachEvent && self._sync) {
|
854
857
|
element.each(function () {
|
855
|
-
|
858
|
+
if (self._sync) {
|
859
|
+
this.detachEvent("onpropertychange", self._sync);
|
860
|
+
}
|
856
861
|
});
|
857
862
|
}
|
858
863
|
if (this.propertyObserver) {
|
@@ -866,7 +871,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
866
871
|
select2.liveRegion.remove();
|
867
872
|
select2.dropdown.remove();
|
868
873
|
element
|
869
|
-
.
|
874
|
+
.show()
|
870
875
|
.removeData("select2")
|
871
876
|
.off(".select2")
|
872
877
|
.prop("autofocus", this.autofocus || false);
|
@@ -1058,7 +1063,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1058
1063
|
if (opts.initSelection === undefined) {
|
1059
1064
|
opts.initSelection = function (element, callback) {
|
1060
1065
|
var data = [];
|
1061
|
-
$(splitVal(element.val(), opts.separator)).each(function () {
|
1066
|
+
$(splitVal(element.val(), opts.separator, opts.transformVal)).each(function () {
|
1062
1067
|
var obj = { id: this, text: this },
|
1063
1068
|
tags = opts.tags;
|
1064
1069
|
if ($.isFunction(tags)) tags=tags();
|
@@ -1113,11 +1118,15 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1113
1118
|
if (readonly === undefined) readonly = false;
|
1114
1119
|
this.readonly(readonly);
|
1115
1120
|
|
1116
|
-
|
1117
|
-
|
1121
|
+
if (this.container) {
|
1122
|
+
syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
|
1123
|
+
this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));
|
1124
|
+
}
|
1118
1125
|
|
1119
|
-
|
1120
|
-
|
1126
|
+
if (this.dropdown) {
|
1127
|
+
syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
|
1128
|
+
this.dropdown.addClass(evaluate(this.opts.dropdownCssClass, this.opts.element));
|
1129
|
+
}
|
1121
1130
|
|
1122
1131
|
});
|
1123
1132
|
|
@@ -1222,9 +1231,10 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1222
1231
|
// abstract
|
1223
1232
|
positionDropdown: function() {
|
1224
1233
|
var $dropdown = this.dropdown,
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1234
|
+
container = this.container,
|
1235
|
+
offset = container.offset(),
|
1236
|
+
height = container.outerHeight(false),
|
1237
|
+
width = container.outerWidth(false),
|
1228
1238
|
dropHeight = $dropdown.outerHeight(false),
|
1229
1239
|
$window = $(window),
|
1230
1240
|
windowWidth = $window.width(),
|
@@ -1236,7 +1246,12 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1236
1246
|
enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
|
1237
1247
|
enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(),
|
1238
1248
|
dropWidth = $dropdown.outerWidth(false),
|
1239
|
-
enoughRoomOnRight =
|
1249
|
+
enoughRoomOnRight = function() {
|
1250
|
+
return dropLeft + dropWidth <= viewPortRight;
|
1251
|
+
},
|
1252
|
+
enoughRoomOnLeft = function() {
|
1253
|
+
return offset.left + viewPortRight + container.outerWidth(false) > dropWidth;
|
1254
|
+
},
|
1240
1255
|
aboveNow = $dropdown.hasClass("select2-drop-above"),
|
1241
1256
|
bodyOffset,
|
1242
1257
|
above,
|
@@ -1271,7 +1286,6 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1271
1286
|
dropTop = offset.top + height;
|
1272
1287
|
dropLeft = offset.left;
|
1273
1288
|
dropWidth = $dropdown.outerWidth(false);
|
1274
|
-
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight;
|
1275
1289
|
$dropdown.show();
|
1276
1290
|
|
1277
1291
|
// fix so the cursor does not move to the left within the search-textbox in IE
|
@@ -1286,7 +1300,6 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1286
1300
|
dropWidth = $dropdown.outerWidth(false) + (resultsListNode.scrollHeight === resultsListNode.clientHeight ? 0 : scrollBarDimensions.width);
|
1287
1301
|
dropWidth > width ? width = dropWidth : dropWidth = width;
|
1288
1302
|
dropHeight = $dropdown.outerHeight(false);
|
1289
|
-
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight;
|
1290
1303
|
}
|
1291
1304
|
else {
|
1292
1305
|
this.container.removeClass('select2-drop-auto-width');
|
@@ -1302,7 +1315,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1302
1315
|
dropLeft -= bodyOffset.left;
|
1303
1316
|
}
|
1304
1317
|
|
1305
|
-
if (!enoughRoomOnRight) {
|
1318
|
+
if (!enoughRoomOnRight() && enoughRoomOnLeft()) {
|
1306
1319
|
dropLeft = offset.left + this.container.outerWidth(false) - dropWidth;
|
1307
1320
|
}
|
1308
1321
|
|
@@ -1391,7 +1404,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1391
1404
|
|
1392
1405
|
// create the dropdown mask if doesn't already exist
|
1393
1406
|
mask = $("#select2-drop-mask");
|
1394
|
-
if (mask.length
|
1407
|
+
if (mask.length === 0) {
|
1395
1408
|
mask = $(document.createElement("div"));
|
1396
1409
|
mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask");
|
1397
1410
|
mask.hide();
|
@@ -1525,7 +1538,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1525
1538
|
}
|
1526
1539
|
}
|
1527
1540
|
|
1528
|
-
rb = results.offset().top + results.outerHeight(
|
1541
|
+
rb = results.offset().top + results.outerHeight(false);
|
1529
1542
|
if (hb > rb) {
|
1530
1543
|
results.scrollTop(results.scrollTop() + (hb - rb));
|
1531
1544
|
}
|
@@ -1648,7 +1661,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1648
1661
|
self.postprocessResults(data, false, false);
|
1649
1662
|
|
1650
1663
|
if (data.more===true) {
|
1651
|
-
more.detach().appendTo(results).
|
1664
|
+
more.detach().appendTo(results).html(self.opts.escapeMarkup(evaluate(self.opts.formatLoadMore, self.opts.element, page+1)));
|
1652
1665
|
window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
|
1653
1666
|
} else {
|
1654
1667
|
more.remove();
|
@@ -1701,7 +1714,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1701
1714
|
self.liveRegion.text(results.text());
|
1702
1715
|
}
|
1703
1716
|
else {
|
1704
|
-
self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable').length));
|
1717
|
+
self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable:not(".select2-selected")').length));
|
1705
1718
|
}
|
1706
1719
|
}
|
1707
1720
|
|
@@ -2096,6 +2109,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2096
2109
|
this.focusser.attr("id", "s2id_autogen"+idSuffix);
|
2097
2110
|
|
2098
2111
|
elementLabel = $("label[for='" + this.opts.element.attr("id") + "']");
|
2112
|
+
this.opts.element.focus(this.bind(function () { this.focus(); }));
|
2099
2113
|
|
2100
2114
|
this.focusser.prev()
|
2101
2115
|
.text(elementLabel.text())
|
@@ -2200,11 +2214,17 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2200
2214
|
}));
|
2201
2215
|
|
2202
2216
|
selection.on("mousedown touchstart", "abbr", this.bind(function (e) {
|
2203
|
-
if (!this.isInterfaceEnabled())
|
2217
|
+
if (!this.isInterfaceEnabled()) {
|
2218
|
+
return;
|
2219
|
+
}
|
2220
|
+
|
2204
2221
|
this.clear();
|
2205
2222
|
killEventImmediately(e);
|
2206
2223
|
this.close();
|
2207
|
-
|
2224
|
+
|
2225
|
+
if (this.selection) {
|
2226
|
+
this.selection.focus();
|
2227
|
+
}
|
2208
2228
|
}));
|
2209
2229
|
|
2210
2230
|
selection.on("mousedown touchstart", this.bind(function (e) {
|
@@ -2253,7 +2273,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2253
2273
|
}));
|
2254
2274
|
|
2255
2275
|
this.initContainerWidth();
|
2256
|
-
this.opts.element.
|
2276
|
+
this.opts.element.hide();
|
2257
2277
|
this.setPlaceholder();
|
2258
2278
|
|
2259
2279
|
},
|
@@ -2582,7 +2602,6 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2582
2602
|
self=this;
|
2583
2603
|
|
2584
2604
|
// TODO validate placeholder is a string if specified
|
2585
|
-
|
2586
2605
|
if (opts.element.get(0).tagName.toLowerCase() === "select") {
|
2587
2606
|
// install the selection initializer
|
2588
2607
|
opts.initSelection = function (element, callback) {
|
@@ -2597,7 +2616,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2597
2616
|
} else if ("data" in opts) {
|
2598
2617
|
// install default initSelection when applied to hidden input and data is local
|
2599
2618
|
opts.initSelection = opts.initSelection || function (element, callback) {
|
2600
|
-
var ids = splitVal(element.val(), opts.separator);
|
2619
|
+
var ids = splitVal(element.val(), opts.separator, opts.transformVal);
|
2601
2620
|
//search in data by array of ids, storing matching items in a list
|
2602
2621
|
var matches = [];
|
2603
2622
|
opts.query({
|
@@ -2674,8 +2693,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2674
2693
|
this.selection = selection = this.container.find(selector);
|
2675
2694
|
|
2676
2695
|
var _this = this;
|
2677
|
-
this.selection.on("click", ".select2-search-choice:not(.select2-locked)", function (e) {
|
2678
|
-
//killEvent(e);
|
2696
|
+
this.selection.on("click", ".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)", function (e) {
|
2679
2697
|
_this.search[0].focus();
|
2680
2698
|
_this.selectChoice($(this));
|
2681
2699
|
});
|
@@ -2686,6 +2704,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2686
2704
|
this.search.prev()
|
2687
2705
|
.text($("label[for='" + this.opts.element.attr("id") + "']").text())
|
2688
2706
|
.attr('for', this.search.attr('id'));
|
2707
|
+
this.opts.element.focus(this.bind(function () { this.focus(); }));
|
2689
2708
|
|
2690
2709
|
this.search.on("input paste", this.bind(function() {
|
2691
2710
|
if (this.search.attr('placeholder') && this.search.val().length == 0) return;
|
@@ -2837,7 +2856,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2837
2856
|
}));
|
2838
2857
|
|
2839
2858
|
this.initContainerWidth();
|
2840
|
-
this.opts.element.
|
2859
|
+
this.opts.element.hide();
|
2841
2860
|
|
2842
2861
|
// set the placeholder if necessary
|
2843
2862
|
this.clearSearch();
|
@@ -3046,7 +3065,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3046
3065
|
|
3047
3066
|
formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
|
3048
3067
|
if (formatted != undefined) {
|
3049
|
-
choice.find("div").replaceWith("<div
|
3068
|
+
choice.find("div").replaceWith($("<div></div>").html(formatted));
|
3050
3069
|
}
|
3051
3070
|
cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
|
3052
3071
|
if (cssClass != undefined) {
|
@@ -3144,7 +3163,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3144
3163
|
}
|
3145
3164
|
});
|
3146
3165
|
|
3147
|
-
if (this.highlight() == -1 && noHighlightUpdate !== false){
|
3166
|
+
if (this.highlight() == -1 && noHighlightUpdate !== false && this.opts.closeOnSelect === true){
|
3148
3167
|
self.highlight(0);
|
3149
3168
|
}
|
3150
3169
|
|
@@ -3201,7 +3220,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3201
3220
|
return val === null ? [] : val;
|
3202
3221
|
} else {
|
3203
3222
|
val = this.opts.element.val();
|
3204
|
-
return splitVal(val, this.opts.separator);
|
3223
|
+
return splitVal(val, this.opts.separator, this.opts.transformVal);
|
3205
3224
|
}
|
3206
3225
|
},
|
3207
3226
|
|
@@ -3231,7 +3250,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3231
3250
|
if (equal(this.opts.id(current[i]), this.opts.id(old[j]))) {
|
3232
3251
|
current.splice(i, 1);
|
3233
3252
|
if(i>0){
|
3234
|
-
|
3253
|
+
i--;
|
3235
3254
|
}
|
3236
3255
|
old.splice(j, 1);
|
3237
3256
|
j--;
|
@@ -3414,11 +3433,14 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3414
3433
|
dropdownCssClass: "",
|
3415
3434
|
formatResult: function(result, container, query, escapeMarkup) {
|
3416
3435
|
var markup=[];
|
3417
|
-
markMatch(
|
3436
|
+
markMatch(this.text(result), query.term, markup, escapeMarkup);
|
3418
3437
|
return markup.join("");
|
3419
3438
|
},
|
3439
|
+
transformVal: function(val) {
|
3440
|
+
return $.trim(val);
|
3441
|
+
},
|
3420
3442
|
formatSelection: function (data, container, escapeMarkup) {
|
3421
|
-
return data ? escapeMarkup(
|
3443
|
+
return data ? escapeMarkup(this.text(data)) : undefined;
|
3422
3444
|
},
|
3423
3445
|
sortResults: function (results, container, query) {
|
3424
3446
|
return results;
|
@@ -3430,6 +3452,17 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3430
3452
|
maximumInputLength: null,
|
3431
3453
|
maximumSelectionSize: 0,
|
3432
3454
|
id: function (e) { return e == undefined ? null : e.id; },
|
3455
|
+
text: function (e) {
|
3456
|
+
if (e && this.data && this.data.text) {
|
3457
|
+
if ($.isFunction(this.data.text)) {
|
3458
|
+
return this.data.text(e);
|
3459
|
+
} else {
|
3460
|
+
return e[this.data.text];
|
3461
|
+
}
|
3462
|
+
} else {
|
3463
|
+
return e.text;
|
3464
|
+
}
|
3465
|
+
},
|
3433
3466
|
matcher: function(term, text) {
|
3434
3467
|
return stripDiacritics(''+text).toUpperCase().indexOf(stripDiacritics(''+term).toUpperCase()) >= 0;
|
3435
3468
|
},
|
@@ -3473,7 +3506,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3473
3506
|
formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); },
|
3474
3507
|
formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
|
3475
3508
|
formatLoadMore: function (pageNumber) { return "Loading more results…"; },
|
3476
|
-
formatSearching: function () { return "Searching…"; }
|
3509
|
+
formatSearching: function () { return "Searching…"; }
|
3477
3510
|
};
|
3478
3511
|
|
3479
3512
|
$.extend($.fn.select2.defaults, $.fn.select2.locales['en']);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
/**
|
2
2
|
* Select2 Arabic translation.
|
3
3
|
*
|
4
4
|
* Author: Adel KEDJOUR <adel@kedjour.com>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
formatNoMatches: function () { return "لم يتم العثور على مطابقات"; },
|
11
11
|
formatInputTooShort: function (input, min) { var n = min - input.length; if (n == 1){ return "الرجاء إدخال حرف واحد على الأكثر"; } return n == 2 ? "الرجاء إدخال حرفين على الأكثر" : "الرجاء إدخال " + n + " على الأكثر"; },
|
12
12
|
formatInputTooLong: function (input, max) { var n = input.length - max; if (n == 1){ return "الرجاء إدخال حرف واحد على الأقل"; } return n == 2 ? "الرجاء إدخال حرفين على الأقل" : "الرجاء إدخال " + n + " على الأقل "; },
|
13
|
-
formatSelectionTooBig: function (limit) { if (
|
13
|
+
formatSelectionTooBig: function (limit) { if (limit == 1){ return "يمكنك أن تختار إختيار واحد فقط"; } return limit == 2 ? "يمكنك أن تختار إختيارين فقط" : "يمكنك أن تختار " + limit + " إختيارات فقط"; },
|
14
14
|
formatLoadMore: function (pageNumber) { return "تحميل المزيد من النتائج…"; },
|
15
15
|
formatSearching: function () { return "البحث…"; }
|
16
16
|
};
|
@@ -5,12 +5,14 @@
|
|
5
5
|
"use strict";
|
6
6
|
|
7
7
|
$.fn.select2.locales['es'] = {
|
8
|
+
formatMatches: function (matches) { if (matches === 1) { return "Un resultado disponible, presione enter para seleccionarlo."; } return matches + " resultados disponibles, use las teclas de dirección para navegar."; },
|
8
9
|
formatNoMatches: function () { return "No se encontraron resultados"; },
|
9
10
|
formatInputTooShort: function (input, min) { var n = min - input.length; return "Por favor, introduzca " + n + " car" + (n == 1? "ácter" : "acteres"); },
|
10
11
|
formatInputTooLong: function (input, max) { var n = input.length - max; return "Por favor, elimine " + n + " car" + (n == 1? "ácter" : "acteres"); },
|
11
12
|
formatSelectionTooBig: function (limit) { return "Sólo puede seleccionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
|
12
13
|
formatLoadMore: function (pageNumber) { return "Cargando más resultados…"; },
|
13
|
-
formatSearching: function () { return "Buscando…"; }
|
14
|
+
formatSearching: function () { return "Buscando…"; },
|
15
|
+
formatAjaxError: function() { return "La carga falló"; }
|
14
16
|
};
|
15
17
|
|
16
18
|
$.extend($.fn.select2.defaults, $.fn.select2.locales['es']);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* Select2 Norwegian Bokmål translation.
|
3
|
+
*
|
4
|
+
* Author: Torgeir Veimo <torgeir.veimo@gmail.com>
|
5
|
+
* Author: Bjørn Johansen <post@bjornjohansen.no>
|
6
|
+
*/
|
7
|
+
(function ($) {
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
$.fn.select2.locales['nb'] = {
|
11
|
+
formatMatches: function (matches) { if (matches === 1) { return "Ett resultat er tilgjengelig, trykk enter for å velge det."; } return matches + " resultater er tilgjengelig. Bruk piltastene opp og ned for å navigere."; },
|
12
|
+
formatNoMatches: function () { return "Ingen treff"; },
|
13
|
+
formatInputTooShort: function (input, min) { var n = min - input.length; return "Vennligst skriv inn " + n + (n>1 ? " flere tegn" : " tegn til"); },
|
14
|
+
formatInputTooLong: function (input, max) { var n = input.length - max; return "Vennligst fjern " + n + " tegn"; },
|
15
|
+
formatSelectionTooBig: function (limit) { return "Du kan velge maks " + limit + " elementer"; },
|
16
|
+
formatLoadMore: function (pageNumber) { return "Laster flere resultater …"; },
|
17
|
+
formatSearching: function () { return "Søker …"; }
|
18
|
+
};
|
19
|
+
|
20
|
+
$.extend($.fn.select2.defaults, $.fn.select2.locales['no']);
|
21
|
+
})(jQuery);
|
22
|
+
|
@@ -1,25 +1,54 @@
|
|
1
1
|
/**
|
2
2
|
* Select2 Polish translation.
|
3
|
-
*
|
3
|
+
*
|
4
4
|
* @author Jan Kondratowicz <jan@kondratowicz.pl>
|
5
5
|
* @author Uriy Efremochkin <efremochkin@uriy.me>
|
6
6
|
* @author Michał Połtyn <mike@poltyn.com>
|
7
|
+
* @author Damian Zajkowski <damian.zajkowski@gmail.com>
|
7
8
|
*/
|
8
|
-
(function
|
9
|
+
(function($) {
|
9
10
|
"use strict";
|
10
11
|
|
11
12
|
$.fn.select2.locales['pl'] = {
|
12
|
-
formatNoMatches: function
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
formatNoMatches: function() {
|
14
|
+
return "Brak wyników";
|
15
|
+
},
|
16
|
+
formatInputTooShort: function(input, min) {
|
17
|
+
return "Wpisz co najmniej" + character(min - input.length, "znak", "i");
|
18
|
+
},
|
19
|
+
formatInputTooLong: function(input, max) {
|
20
|
+
return "Wpisana fraza jest za długa o" + character(input.length - max, "znak", "i");
|
21
|
+
},
|
22
|
+
formatSelectionTooBig: function(limit) {
|
23
|
+
return "Możesz zaznaczyć najwyżej" + character(limit, "element", "y");
|
24
|
+
},
|
25
|
+
formatLoadMore: function(pageNumber) {
|
26
|
+
return "Ładowanie wyników…";
|
27
|
+
},
|
28
|
+
formatSearching: function() {
|
29
|
+
return "Szukanie…";
|
30
|
+
}
|
18
31
|
};
|
19
32
|
|
20
33
|
$.extend($.fn.select2.defaults, $.fn.select2.locales['pl']);
|
21
34
|
|
22
|
-
function character
|
23
|
-
|
35
|
+
function character(n, word, pluralSuffix) {
|
36
|
+
//Liczba pojedyncza - brak suffiksu
|
37
|
+
//jeden znak
|
38
|
+
//jeden element
|
39
|
+
var suffix = '';
|
40
|
+
if (n > 1 && n < 5) {
|
41
|
+
//Liczaba mnoga ilość od 2 do 4 - własny suffiks
|
42
|
+
//Dwa znaki, trzy znaki, cztery znaki.
|
43
|
+
//Dwa elementy, trzy elementy, cztery elementy
|
44
|
+
suffix = pluralSuffix;
|
45
|
+
} else if (n == 0 || n >= 5) {
|
46
|
+
//Ilość 0 suffiks ów
|
47
|
+
//Liczaba mnoga w ilości 5 i więcej - suffiks ów (nie poprawny dla wszystkich wyrazów, np. 100 wiadomości)
|
48
|
+
//Zero znaków, Pięć znaków, sześć znaków, siedem znaków, osiem znaków.
|
49
|
+
//Zero elementów Pięć elementów, sześć elementów, siedem elementów, osiem elementów.
|
50
|
+
suffix = 'ów';
|
51
|
+
}
|
52
|
+
return " " + n + " " + word + suffix;
|
24
53
|
}
|
25
54
|
})(jQuery);
|
@@ -6,7 +6,8 @@
|
|
6
6
|
|
7
7
|
$.fn.select2.locales['pt-BR'] = {
|
8
8
|
formatNoMatches: function () { return "Nenhum resultado encontrado"; },
|
9
|
-
|
9
|
+
formatAjaxError: function () { return "Erro na busca"; },
|
10
|
+
formatInputTooShort: function (input, min) { var n = min - input.length; return "Digite " + (min == 1 ? "" : "mais") + " " + n + " caracter" + (n == 1? "" : "es"); },
|
10
11
|
formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " caracter" + (n == 1? "" : "es"); },
|
11
12
|
formatSelectionTooBig: function (limit) { return "Só é possível selecionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
|
12
13
|
formatLoadMore: function (pageNumber) { return "Carregando mais resultados…"; },
|
@@ -27,7 +27,7 @@
|
|
27
27
|
var n = input.length - max;
|
28
28
|
if (n == 1) {
|
29
29
|
return "Prosím, zadajte o jeden znak menej";
|
30
|
-
} else if (n <= 4) {
|
30
|
+
} else if (n >= 2 && n <= 4) {
|
31
31
|
return "Prosím, zadajte o "+smallNumbers[n](true)+" znaky menej";
|
32
32
|
} else {
|
33
33
|
return "Prosím, zadajte o "+n+" znakov menej";
|
@@ -36,7 +36,7 @@
|
|
36
36
|
formatSelectionTooBig: function (limit) {
|
37
37
|
if (limit == 1) {
|
38
38
|
return "Môžete zvoliť len jednu položku";
|
39
|
-
} else if (limit <= 4) {
|
39
|
+
} else if (limit >= 2 && limit <= 4) {
|
40
40
|
return "Môžete zvoliť najviac "+smallNumbers[limit](false)+" položky";
|
41
41
|
} else {
|
42
42
|
return "Môžete zvoliť najviac "+limit+" položiek";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Version: 3.5.
|
2
|
+
Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
|
3
3
|
*/
|
4
4
|
.select2-container {
|
5
5
|
margin: 0;
|
@@ -586,7 +586,7 @@ html[dir="rtl"] .select2-container-multi .select2-choices li
|
|
586
586
|
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee));
|
587
587
|
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
588
588
|
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
589
|
-
background-image: linear-gradient(to
|
589
|
+
background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
590
590
|
}
|
591
591
|
html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
|
592
592
|
{
|
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.9.
|
4
|
+
version: 3.5.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rogerio Medeiros
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- vendor/assets/javascripts/select2_locale_lv.js
|
119
119
|
- vendor/assets/javascripts/select2_locale_mk.js
|
120
120
|
- vendor/assets/javascripts/select2_locale_ms.js
|
121
|
+
- vendor/assets/javascripts/select2_locale_nb.js
|
121
122
|
- vendor/assets/javascripts/select2_locale_nl.js
|
122
123
|
- vendor/assets/javascripts/select2_locale_no.js
|
123
124
|
- vendor/assets/javascripts/select2_locale_pl.js
|