active_admin-cep_auto_complete 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b85ab31bbf5b9995a30db2c013bf1982844668dd
|
4
|
+
data.tar.gz: b525f8a03d0bfa96061da52b80aa0070f7fa2fbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d9c36a0dfc45ac45fe27c90adaaba0ef283914440d2d3b05ab7b52e6b782c4c512eb4d4768fac93265243bbb90d44a6d12567613f61b96886e4aee27449f931
|
7
|
+
data.tar.gz: 82c95f59a2c394f7f98b34966b345988f273549f6c247c2e5ebd8e95cc35f1c0b4498ca829b120b63a78197d0bb1e2791841cf2e99d001f9e0658e55c1e50626
|
data/README.md
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
}.bind(this), {});
|
15
15
|
this.cepRegex = new RegExp(this.input.data('cepRegex'));
|
16
16
|
this.onChange = scope.Utils.debounce(this.onChange.bind(this), 300);
|
17
|
+
this.lastValue = null;
|
17
18
|
this.lastQuery = null;
|
18
19
|
this.attachEvents();
|
19
20
|
}
|
@@ -35,8 +36,10 @@
|
|
35
36
|
},
|
36
37
|
|
37
38
|
onChange: function(e) {
|
38
|
-
|
39
|
-
|
39
|
+
var value = e.delegateTarget.value;
|
40
|
+
|
41
|
+
if (this.isValid(value) && this.hasChanged(value)) {
|
42
|
+
this.query(value);
|
40
43
|
}
|
41
44
|
},
|
42
45
|
|
@@ -44,12 +47,17 @@
|
|
44
47
|
return !!value.match(this.cepRegex);
|
45
48
|
},
|
46
49
|
|
50
|
+
hasChanged: function(value) {
|
51
|
+
return this.lastValue !== value;
|
52
|
+
},
|
53
|
+
|
47
54
|
query: function(value) {
|
48
55
|
if (this.lastQuery !== null) {
|
49
56
|
this.lastQuery.abort();
|
50
57
|
}
|
51
58
|
|
52
59
|
this.lockFields();
|
60
|
+
this.lastValue = value;
|
53
61
|
this.lastQuery = $.get(this.url, { cep: value })
|
54
62
|
.then(function(data) {
|
55
63
|
this.render(data);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_admin-cep_auto_complete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dhyego Fernando
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|