select2-rails 3.4.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/select2.js +44 -44
- data/lib/select2-rails/version.rb +1 -1
- data/select2-rails.gemspec +1 -1
- metadata +4 -5
@@ -19,23 +19,23 @@ CONDITIONS OF ANY KIND, either express or implied. See the Apache License and th
|
|
19
19
|
the specific language governing permissions and limitations under the Apache License and the GPL License.
|
20
20
|
*/
|
21
21
|
(function ($) {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
22
|
+
if(typeof $.fn.each2 == "undefined"){
|
23
|
+
$.fn.extend({
|
24
|
+
/*
|
25
|
+
* 4-10 times faster .each replacement
|
26
|
+
* use it carefully, as it overrides jQuery context of element on each iteration
|
27
|
+
*/
|
28
|
+
each2 : function (c) {
|
29
|
+
var j = $([0]), i = -1, l = this.length;
|
30
|
+
while (
|
31
|
+
++i < l
|
32
|
+
&& (j.context = j[0] = this[i])
|
33
|
+
&& c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
|
34
|
+
);
|
35
|
+
return this;
|
36
|
+
}
|
37
|
+
});
|
38
|
+
}
|
39
39
|
})(jQuery);
|
40
40
|
|
41
41
|
(function ($, undefined) {
|
@@ -182,7 +182,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
182
182
|
* the elements under the pointer are scrolled.
|
183
183
|
*/
|
184
184
|
function installFilteredMouseMove(element) {
|
185
|
-
|
185
|
+
element.on("mousemove", function (e) {
|
186
186
|
var lastpos = lastMousePosition;
|
187
187
|
if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
|
188
188
|
$(e.target).trigger("mousemove-filtered", e);
|
@@ -290,22 +290,22 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
290
290
|
|
291
291
|
function measureTextWidth(e) {
|
292
292
|
if (!sizer){
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
293
|
+
var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
|
294
|
+
sizer = $(document.createElement("div")).css({
|
295
|
+
position: "absolute",
|
296
|
+
left: "-10000px",
|
297
|
+
top: "-10000px",
|
298
|
+
display: "none",
|
299
|
+
fontSize: style.fontSize,
|
300
|
+
fontFamily: style.fontFamily,
|
301
|
+
fontStyle: style.fontStyle,
|
302
|
+
fontWeight: style.fontWeight,
|
303
|
+
letterSpacing: style.letterSpacing,
|
304
|
+
textTransform: style.textTransform,
|
305
|
+
whiteSpace: "nowrap"
|
306
|
+
});
|
307
307
|
sizer.attr("class","select2-sizer");
|
308
|
-
|
308
|
+
$("body").append(sizer);
|
309
309
|
}
|
310
310
|
sizer.text(e.val());
|
311
311
|
return sizer.width();
|
@@ -447,12 +447,12 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
447
447
|
tmp,
|
448
448
|
text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
|
449
449
|
|
450
|
-
|
450
|
+
if ($.isArray(data)) {
|
451
451
|
tmp = data;
|
452
452
|
data = { results: tmp };
|
453
453
|
}
|
454
454
|
|
455
|
-
|
455
|
+
if ($.isFunction(data) === false) {
|
456
456
|
tmp = data;
|
457
457
|
data = function() { return tmp; };
|
458
458
|
}
|
@@ -1085,14 +1085,14 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1085
1085
|
height = this.container.outerHeight(false),
|
1086
1086
|
width = this.container.outerWidth(false),
|
1087
1087
|
dropHeight = $dropdown.outerHeight(false),
|
1088
|
-
|
1088
|
+
viewPortRight = $(window).scrollLeft() + $(window).width(),
|
1089
1089
|
viewportBottom = $(window).scrollTop() + $(window).height(),
|
1090
1090
|
dropTop = offset.top + height,
|
1091
1091
|
dropLeft = offset.left,
|
1092
1092
|
enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
|
1093
1093
|
enoughRoomAbove = (offset.top - dropHeight) >= this.body().scrollTop(),
|
1094
|
-
|
1095
|
-
|
1094
|
+
dropWidth = $dropdown.outerWidth(false),
|
1095
|
+
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight,
|
1096
1096
|
aboveNow = $dropdown.hasClass("select2-drop-above"),
|
1097
1097
|
bodyOffset,
|
1098
1098
|
above,
|
@@ -1403,7 +1403,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1403
1403
|
highlightUnderEvent: function (event) {
|
1404
1404
|
var el = $(event.target).closest(".select2-result-selectable");
|
1405
1405
|
if (el.length > 0 && !el.is(".select2-highlighted")) {
|
1406
|
-
|
1406
|
+
var choices = this.findHighlightableChoices();
|
1407
1407
|
this.highlight(choices.index(el));
|
1408
1408
|
} else if (el.length == 0) {
|
1409
1409
|
// if we are over an unselectable item remove al highlights
|
@@ -1501,8 +1501,8 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1501
1501
|
if (maxSelSize >=1) {
|
1502
1502
|
data = this.data();
|
1503
1503
|
if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
|
1504
|
-
|
1505
|
-
|
1504
|
+
render("<li class='select2-selection-limit'>" + opts.formatSelectionTooBig(maxSelSize) + "</li>");
|
1505
|
+
return;
|
1506
1506
|
}
|
1507
1507
|
}
|
1508
1508
|
|
@@ -1691,7 +1691,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
1691
1691
|
|
1692
1692
|
// single
|
1693
1693
|
|
1694
|
-
|
1694
|
+
createContainer: function () {
|
1695
1695
|
var container = $(document.createElement("div")).attr({
|
1696
1696
|
"class": "select2-container"
|
1697
1697
|
}).html([
|
@@ -2201,7 +2201,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2201
2201
|
" <ul class='select2-results'>" ,
|
2202
2202
|
" </ul>" ,
|
2203
2203
|
"</div>"].join(""));
|
2204
|
-
|
2204
|
+
return container;
|
2205
2205
|
},
|
2206
2206
|
|
2207
2207
|
// multi
|
@@ -2742,7 +2742,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
2742
2742
|
// multi
|
2743
2743
|
resizeSearch: function () {
|
2744
2744
|
var minimumWidth, left, maxWidth, containerLeft, searchWidth,
|
2745
|
-
|
2745
|
+
sideBorderPadding = getSideBorderPadding(this.search);
|
2746
2746
|
|
2747
2747
|
minimumWidth = measureTextWidth(this.search) + 10;
|
2748
2748
|
|
data/select2-rails.gemspec
CHANGED
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_dependency "thor", "~> 0.14"
|
19
19
|
s.add_runtime_dependency "sass-rails"
|
20
20
|
s.add_development_dependency "bundler", "~> 1.0"
|
21
|
-
s.add_development_dependency "rails", "
|
21
|
+
s.add_development_dependency "rails", ">= 3.0"
|
22
22
|
s.add_development_dependency "httpclient", "~> 2.2"
|
23
23
|
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.4.
|
4
|
+
version: 3.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '3.0'
|
71
71
|
type: :development
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ! '>='
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '3.0'
|
79
79
|
- !ruby/object:Gem::Dependency
|
@@ -142,4 +142,3 @@ signing_key:
|
|
142
142
|
specification_version: 3
|
143
143
|
summary: Integrate Select2 javascript library with Rails asset pipeline
|
144
144
|
test_files: []
|
145
|
-
has_rdoc:
|