geocomplete_rails 1.4.1 → 1.4.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWIyMTc0ZmU5YzJmZWJiYjAzYTM3Y2ZkYWZiMzlmODJjYjJhNjg0MQ==
5
+ data.tar.gz: !binary |-
6
+ MzJjMjUyN2ZlYjNlOGFkZmRlMzIwZjM5MWNmZWE2MzQ1NDUzMzk2MA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NmFiZjM2NTcyODQ3NDI1NjVkNmY0M2RjOGJmZGQ0MGQwNDhjYWI2ZDE5ZjAx
10
+ YTA2NWRjMDA2NmM3N2Y3YWI2ODdlM2Q3NDVkYjE5ZTZmNTZjZGQ0MDJhN2Mw
11
+ ODlkY2M2ZWM4OTFkZDFhODg5NDFkMzgzY2E3MTk5Zjg2MjM4ZGE=
12
+ data.tar.gz: !binary |-
13
+ Yzg3YzI4ZDYyZjc2NGMzYzFkNzBhY2ZjN2UzZjY2M2I3MjA3YWU3OTE5M2Q0
14
+ YzgzZGY4MDE1ZWQ1NjJhYTJiNjNiZWUzNGY0ZTY5Y2JmNGM2MTFjMzlhMzAx
15
+ ZjRjZTE2ODIzMGI0M2ZmNDQ2NDRjNDI4MzI5ZWQ1OWMyNDNlMjI=
@@ -1,4 +1,4 @@
1
- /*!
1
+ /**
2
2
  * jQuery Geocoding and Places Autocomplete Plugin - V 1.4.1
3
3
  *
4
4
  * @author Martin Kleppe <kleppe@ubilabs.net>, 2012
@@ -6,8 +6,13 @@
6
6
  * @license MIT License <http://www.opensource.org/licenses/mit-license.php>
7
7
  */
8
8
 
9
+ // # $.geocomplete()
10
+ // ## jQuery Geocoding and Places Autocomplete Plugin - V 1.4.1
11
+ //
12
+ // * https://github.com/ubilabs/geocomplete/
13
+ // * by Martin Kleppe <kleppe@ubilabs.net>
9
14
 
10
- ;(function($, window, document, undefined){
15
+ (function($, window, document, undefined){
11
16
 
12
17
  // ## Options
13
18
  // The default options for this plugin.
@@ -264,6 +269,32 @@
264
269
  this.geocoder.geocode(request, $.proxy(this.handleGeocode, this));
265
270
  },
266
271
 
272
+ // Get the selected result. If no result is selected on the list, then get
273
+ // the first result from the list.
274
+ selectFirstResult: function() {
275
+ //$(".pac-container").hide();
276
+
277
+ var selected = '';
278
+ // Check if any result is selected.
279
+ if ($(".pac-item-selected")['0']) {
280
+ selected = '-selected';
281
+ }
282
+
283
+ // Get the first suggestion's text.
284
+ var $span1 = $(".pac-container .pac-item" + selected + ":first span:nth-child(2)").text();
285
+ var $span2 = $(".pac-container .pac-item" + selected + ":first span:nth-child(3)").text();
286
+
287
+ // Adds the additional information, if available.
288
+ var firstResult = $span1;
289
+ if ($span2) {
290
+ firstResult += " - " + $span2;
291
+ }
292
+
293
+ this.$input.val(firstResult);
294
+
295
+ return firstResult;
296
+ },
297
+
267
298
  // Handles the geocode response. If more than one results was found
268
299
  // it triggers the "geocode:multiple" events. If there was an error
269
300
  // the "geocode:error" event is fired.
@@ -405,8 +436,12 @@
405
436
  var place = this.autocomplete.getPlace();
406
437
 
407
438
  if (!place.geometry){
408
- this.find(place.name);
439
+ // Automatically selects the highlighted item or the first item from the
440
+ // suggestions list.
441
+ var autoSelection = this.selectFirstResult();
442
+ this.find(autoSelection);
409
443
  } else {
444
+ // Use the input text if it already gives geometry.
410
445
  this.update(place);
411
446
  }
412
447
  }
@@ -1,3 +1,3 @@
1
1
  module GeocompleteRails
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.1.1"
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geocomplete_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
5
- prerelease:
4
+ version: 1.4.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Guy Israeli
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-10 00:00:00.000000000 Z
11
+ date: 2014-01-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: railties
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -78,26 +71,25 @@ files:
78
71
  homepage: https://github.com/guyisra/geocomplete_rails
79
72
  licenses:
80
73
  - MIT
74
+ metadata: {}
81
75
  post_install_message:
82
76
  rdoc_options: []
83
77
  require_paths:
84
78
  - lib
85
79
  required_ruby_version: !ruby/object:Gem::Requirement
86
- none: false
87
80
  requirements:
88
81
  - - ! '>='
89
82
  - !ruby/object:Gem::Version
90
83
  version: '0'
91
84
  required_rubygems_version: !ruby/object:Gem::Requirement
92
- none: false
93
85
  requirements:
94
86
  - - ! '>='
95
87
  - !ruby/object:Gem::Version
96
88
  version: '0'
97
89
  requirements: []
98
90
  rubyforge_project:
99
- rubygems_version: 1.8.24
91
+ rubygems_version: 2.1.3
100
92
  signing_key:
101
- specification_version: 3
93
+ specification_version: 4
102
94
  summary: jQuery Geocoding and Places Autocomplete Plugin
103
95
  test_files: []