combo_auto_box 0.0.50 → 0.0.51
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/combo_auto_box/version.rb +1 -1
- data/vendor/assets/javascripts/combo-auto-box.js +46 -26
- 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: 50b086b14581ee4c93d851bdbdf89e40c85d9c1a
|
4
|
+
data.tar.gz: ca36601bbb3fd52bddb73fc0dd3a94cbf09b4439
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51ceec1b461fad898b25405823d54cf9124e1bf05cd809e8a8e7905d80f91941b49a63e880b47c339d07ce70a37cc8198279104e0839ffd4dc9312e68114560b
|
7
|
+
data.tar.gz: ea89c157c85f09f0b29c48e48853367db8d6d1914374692e52d4f332fbfde2e27b92e07b85edd24f821f86a731ccd3ad330b2dd0ddfb6ddea2b3de59b365b7a9
|
@@ -35,6 +35,7 @@ var ComboAutoBox = {
|
|
35
35
|
|
36
36
|
$('#' + inputId).autocomplete( "close" );
|
37
37
|
if ((options.source_not_found) && (!options.not_found_accepted)) {
|
38
|
+
dataNotFound($('#' + inputId).val());
|
38
39
|
selectData('', '');
|
39
40
|
} else {
|
40
41
|
for (var i = 0; i < emails.length; i++) {
|
@@ -58,6 +59,7 @@ var ComboAutoBox = {
|
|
58
59
|
removeLastSearchableItemForRansack();
|
59
60
|
}
|
60
61
|
} else if ((e.keyCode == 9) && (inputVal != '') && (options.source_not_found) && (options.type == 'simple')) {
|
62
|
+
dataNotFound($('#' + inputId).val());
|
61
63
|
$('#' + inputId).autocomplete( "close");
|
62
64
|
if (!options.not_found_accepted) {
|
63
65
|
$('#' + inputId).val('');
|
@@ -65,6 +67,7 @@ var ComboAutoBox = {
|
|
65
67
|
selectData($('#' + inputId).val(), $('#' + inputId).val());
|
66
68
|
return true;
|
67
69
|
} else if ((e.keyCode == 9) && (inputVal != '') && (options.source_not_found) && (options.type == 'multiple')) {
|
70
|
+
dataNotFound($('#' + inputId).val());
|
68
71
|
$('#' + inputId).autocomplete( "close");
|
69
72
|
var inputVal = $('#' + inputId).val().replace(/\t$/, '');
|
70
73
|
if (options.not_found_accepted) {
|
@@ -93,6 +96,7 @@ var ComboAutoBox = {
|
|
93
96
|
if (((e.which === 32) || (e.which === 44) || (e.which === 59)) && (options.type == 'multiple') && (options.email) && ($('#' + inputId).val().match(/[^@\s]+@([^@\s]+\.)+[^@\s]+/))) {
|
94
97
|
$('#' + inputId).autocomplete( "close" );
|
95
98
|
if ((options.source_not_found) && (!options.not_found_accepted)) {
|
99
|
+
dataNotFound($('#' + inputId).val());
|
96
100
|
$('#' + inputId).val('');
|
97
101
|
} else {
|
98
102
|
addMultipleItem(inputId, $('#' + inputId).val(), $('#' + inputId).val());
|
@@ -108,6 +112,7 @@ var ComboAutoBox = {
|
|
108
112
|
$('#' + inputId).autocomplete( "close" );
|
109
113
|
selectData($('#' + inputId).val(), $('#' + inputId).val());
|
110
114
|
} else if ((options.source_not_found) && (options.type == 'simple')) {
|
115
|
+
dataNotFound($('#' + inputId).val());
|
111
116
|
$('#' + inputId).autocomplete( "close");
|
112
117
|
if (!options.not_found_accepted) {
|
113
118
|
$('#' + inputId).val('');
|
@@ -116,6 +121,7 @@ var ComboAutoBox = {
|
|
116
121
|
} else if (options.type == 'multiple') {
|
117
122
|
$('#' + inputId).autocomplete( "close" );
|
118
123
|
if ((options.source_not_found) && (!options.not_found_accepted)) {
|
124
|
+
dataNotFound($('#' + inputId).val());
|
119
125
|
$('#' + inputId).val('');
|
120
126
|
} else {
|
121
127
|
addMultipleItem(inputId, $('#' + inputId).val(), $('#' + inputId).val());
|
@@ -141,39 +147,46 @@ var ComboAutoBox = {
|
|
141
147
|
});
|
142
148
|
|
143
149
|
$('#' + inputId).autocomplete({
|
144
|
-
|
145
|
-
|
146
|
-
|
150
|
+
source: setAutoCompleteSource(inputId),
|
151
|
+
select: function(event, ui) {
|
152
|
+
if ((options.source_not_found) && (options.type == 'simple')) {
|
153
|
+
dataNotFound($('#' + inputId).val());
|
147
154
|
if (!options.not_found_accepted) {
|
148
155
|
$('#' + inputId).val('');
|
149
156
|
}
|
150
|
-
|
157
|
+
selectData($('#' + inputId).val(), $('#' + inputId).val());
|
151
158
|
return false;
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
159
|
+
}
|
160
|
+
|
161
|
+
if ((options.source_not_found) && (options.type == 'multiple')) {
|
162
|
+
var inputVal = $('#' + inputId).val();
|
163
|
+
|
164
|
+
dataNotFound(inputVal);
|
165
|
+
|
166
|
+
$('#' + inputId).val('');
|
167
|
+
if (options.not_found_accepted) {
|
168
|
+
addMultipleItem(inputId, inputVal, inputVal);
|
157
169
|
} else {
|
158
170
|
inputVal = '';
|
159
171
|
}
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
172
|
+
|
173
|
+
selectData(inputVal, inputVal);
|
174
|
+
return false;
|
175
|
+
} else if (options.type == 'simple') {
|
176
|
+
return selectData(ui.item.id, ui.item.label);
|
177
|
+
} else if (options.type == 'full') {
|
178
|
+
return selectData($('#' + inputId).val(), $('#' + inputId).val());
|
179
|
+
} else if (options.type == 'multiple') {
|
180
|
+
$('#' + inputId).val('');
|
181
|
+
addMultipleItem(inputId, ui.item.id, ui.item.label);
|
182
|
+
selectData(ui.item.id, ui.item.label);
|
183
|
+
return false;
|
184
|
+
} else if (options.type == 'searchable') {
|
185
|
+
$('#' + inputId).val('');
|
186
|
+
addSearchableItemForRansack(inputId, ui.item.id, ui.item.label);
|
187
|
+
selectData(ui.item.id, ui.item.label);
|
188
|
+
return false;
|
189
|
+
}
|
177
190
|
},
|
178
191
|
search: function(event, ui) {
|
179
192
|
if (options.type == 'searchable') {
|
@@ -911,6 +924,13 @@ var ComboAutoBox = {
|
|
911
924
|
}
|
912
925
|
};
|
913
926
|
|
927
|
+
// on data not found
|
928
|
+
var dataNotFound = function (selectedLabel) {
|
929
|
+
if (options.notFound != null) {
|
930
|
+
options.notFound(selectedLabel);
|
931
|
+
}
|
932
|
+
};
|
933
|
+
|
914
934
|
// valid language or set 'en' as default
|
915
935
|
var validLanguage = function () {
|
916
936
|
var langs = ['math', 'en', 'pt-br', 'pt', 'es', 'fr', 'it'];
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: combo_auto_box
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adilson Chacon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|