selectivity-rails 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/selectivity/rails/version.rb +1 -1
- data/lib/selectivity/rspec.rb +1 -1
- data/vendor/assets/javascripts/selectivity.js +32 -28
- 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: 34ad4f9ee657c8b9a129e0d85269e4bcfc371351
|
4
|
+
data.tar.gz: 46e914da3aef1d3efd779c242c6a52f525b77c0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a57ab8f4c34bbe85f32a14f466a75d5c9e33c1dccb45bea9becf6733b6bffbd5da6879bcf15e12cd59fdd16f6cc6f81a5eb0238a849f756e601a0b3f1b25d7c
|
7
|
+
data.tar.gz: e6018c41fea9a6aecbfa18976b642393aba6bf3987b547f6c8850ecf77457c89d2249c7fc0bd91d455136f85f1b11da89472822b398f9c55419c6796f5c57d61
|
data/lib/selectivity/rspec.rb
CHANGED
@@ -55,7 +55,7 @@ module Selectivity
|
|
55
55
|
element = if page.driver.class.name =~ /poltergeist/i
|
56
56
|
find('div.selectivity-result-item', text: item)
|
57
57
|
else
|
58
|
-
find(:xpath, "
|
58
|
+
find(:xpath, ".//div[contains(@class,'selectivity-result-item')][text()='#{item}']")
|
59
59
|
end
|
60
60
|
|
61
61
|
if element.visible?
|
@@ -254,7 +254,7 @@ Selectivity.OptionListeners.unshift(function(selectivity, options) {
|
|
254
254
|
} else {
|
255
255
|
selectivity.dropdown.showLoading();
|
256
256
|
|
257
|
-
var url = (ajax.url instanceof Function ? ajax.url() : ajax.url);
|
257
|
+
var url = (ajax.url instanceof Function ? ajax.url(queryOptions) : ajax.url);
|
258
258
|
if (params) {
|
259
259
|
url += (url.indexOf('?') > -1 ? '&' : '?') + $.param(params(term, offset));
|
260
260
|
}
|
@@ -383,10 +383,11 @@ var EventDelegator = _dereq_(2);
|
|
383
383
|
* @param methodName Optional name of a method to call. If omitted, a Selectivity instance is
|
384
384
|
* created for each element in the set of matched elements. If an element in the
|
385
385
|
* set already has a Selectivity instance, the result is the same as if the
|
386
|
-
* setOptions() method is called.
|
387
|
-
*
|
388
|
-
*
|
389
|
-
*
|
386
|
+
* setOptions() method is called. If a method name is given, the options
|
387
|
+
* parameter is ignored and any additional parameters are passed to the given
|
388
|
+
* method.
|
389
|
+
* @param options Options object to pass to the constructor or the setOptions() method. In case
|
390
|
+
* a new instance is being created, the following properties are used:
|
390
391
|
* inputType - The input type to use. Default input types include 'Multiple' and
|
391
392
|
* 'Single', but you can add custom input types to the InputTypes map or
|
392
393
|
* just specify one here as a function. The default value is 'Single',
|
@@ -401,6 +402,7 @@ var EventDelegator = _dereq_(2);
|
|
401
402
|
function selectivity(methodName, options) {
|
402
403
|
/* jshint validthis: true */
|
403
404
|
|
405
|
+
var methodArgs = Array.prototype.slice.call(arguments, 1);
|
404
406
|
var result;
|
405
407
|
|
406
408
|
this.each(function() {
|
@@ -408,13 +410,13 @@ function selectivity(methodName, options) {
|
|
408
410
|
|
409
411
|
if (instance) {
|
410
412
|
if ($.type(methodName) !== 'string') {
|
411
|
-
|
413
|
+
methodArgs = [methodName];
|
412
414
|
methodName = 'setOptions';
|
413
415
|
}
|
414
416
|
|
415
417
|
if ($.type(instance[methodName]) === 'function') {
|
416
418
|
if (result === undefined) {
|
417
|
-
result = instance[methodName].
|
419
|
+
result = instance[methodName].apply(instance, methodArgs);
|
418
420
|
}
|
419
421
|
} else {
|
420
422
|
throw new Error('Unknown method: ' + methodName);
|
@@ -3102,6 +3104,8 @@ function listener(selectivity, $input) {
|
|
3102
3104
|
setTimeout(function() {
|
3103
3105
|
selectivity.close({ keepFocus: false });
|
3104
3106
|
}, 1);
|
3107
|
+
} else if (event.keyCode === KEY_ENTER) {
|
3108
|
+
event.preventDefault(); // don't submit forms on keydown
|
3105
3109
|
}
|
3106
3110
|
}
|
3107
3111
|
}
|
@@ -3666,7 +3670,7 @@ var callSuper = Selectivity.inherits(MultipleSelectivity, {
|
|
3666
3670
|
|
3667
3671
|
if (event.added || event.removed) {
|
3668
3672
|
if (this.dropdown) {
|
3669
|
-
this.dropdown.showResults(this.filterResults(this.results), {
|
3673
|
+
this.dropdown.showResults(this.filterResults(this.dropdown.results), {
|
3670
3674
|
hasMore: this.dropdown.hasMore
|
3671
3675
|
});
|
3672
3676
|
}
|
@@ -4646,28 +4650,28 @@ function bindTraditionalSelectEvents(selectivity) {
|
|
4646
4650
|
var $el = selectivity.$el;
|
4647
4651
|
|
4648
4652
|
$el.on('selectivity-init', function(event, mode) {
|
4649
|
-
|
4650
|
-
|
4651
|
-
|
4652
|
-
})
|
4653
|
-
|
4654
|
-
|
4655
|
-
|
4656
|
-
|
4657
|
-
|
4658
|
-
|
4659
|
-
|
4660
|
-
|
4661
|
-
|
4662
|
-
|
4653
|
+
$el.append(selectivity.template('selectCompliance', {
|
4654
|
+
mode: mode,
|
4655
|
+
name: $el.attr('data-name')
|
4656
|
+
})).removeAttr('data-name');
|
4657
|
+
}).on('selectivity-init change', function() {
|
4658
|
+
var data = selectivity._data;
|
4659
|
+
var $select = $el.find('select');
|
4660
|
+
|
4661
|
+
if (data instanceof Array) {
|
4662
|
+
$select.empty();
|
4663
|
+
|
4664
|
+
data.forEach(function(item) {
|
4665
|
+
$select.append(selectivity.template('selectOptionCompliance', item));
|
4666
|
+
});
|
4667
|
+
} else {
|
4668
|
+
if (data) {
|
4669
|
+
$select.html(selectivity.template('selectOptionCompliance', data));
|
4663
4670
|
} else {
|
4664
|
-
|
4665
|
-
$select.html(selectivity.template('selectOptionCompliance', data));
|
4666
|
-
} else {
|
4667
|
-
$select.empty();
|
4668
|
-
}
|
4671
|
+
$select.empty();
|
4669
4672
|
}
|
4670
|
-
}
|
4673
|
+
}
|
4674
|
+
});
|
4671
4675
|
}
|
4672
4676
|
|
4673
4677
|
/**
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selectivity-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konrad Jurkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|