gmaps-autocomplete-rails 0.1.2 → 0.1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -4
- data/Gemfile.lock +4 -4
- data/README.md +74 -15
- data/VERSION +1 -1
- data/gmaps-autocomplete-rails.gemspec +15 -15
- metadata +12 -12
data/Gemfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem 'rails', '>= 3.
|
3
|
+
gem 'rails', '>= 3.1.0'
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem "rspec", ">= 2.
|
6
|
+
gem "rspec", ">= 2.9.0"
|
7
7
|
gem "rdoc", ">= 3.12"
|
8
|
-
gem "bundler", ">= 1.
|
9
|
-
gem "jeweler", "
|
8
|
+
gem "bundler", ">= 1.1.0"
|
9
|
+
gem "jeweler", ">= 1.8.4"
|
10
10
|
gem "simplecov", ">= 0.5"
|
11
11
|
end
|
data/Gemfile.lock
CHANGED
@@ -101,9 +101,9 @@ PLATFORMS
|
|
101
101
|
ruby
|
102
102
|
|
103
103
|
DEPENDENCIES
|
104
|
-
bundler (>= 1.
|
105
|
-
jeweler (
|
106
|
-
rails (>= 3.
|
104
|
+
bundler (>= 1.1.0)
|
105
|
+
jeweler (>= 1.8.4)
|
106
|
+
rails (>= 3.1.0)
|
107
107
|
rdoc (>= 3.12)
|
108
|
-
rspec (>= 2.
|
108
|
+
rspec (>= 2.9.0)
|
109
109
|
simplecov (>= 0.5)
|
data/README.md
CHANGED
@@ -2,24 +2,46 @@
|
|
2
2
|
|
3
3
|
Extracted from [gmaps-autocomplete](https://github.com/rjshade/gmaps-autocomplete) and improved markedly and then packaged for use with Rails as an asset gem :)
|
4
4
|
|
5
|
-
See it in action here: [rjshade.
|
5
|
+
See it in action here: [http://rjshade.com/projects/gmaps-autocomplete/](http://rjshade.com/projects/gmaps-autocomplete/)
|
6
6
|
|
7
|
-
Some more explanation here: [
|
7
|
+
Some more explanation here: [https://github.com/rjshade/gmaps-autocomplete](https://github.com/rjshade/gmaps-autocomplete)
|
8
8
|
|
9
|
-
##
|
9
|
+
## Install
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
gem 'gmaps-autocomplete-rails'
|
12
|
+
|
13
|
+
You will also need:
|
14
|
+
* gem 'jquery-rails'
|
15
|
+
* gem 'jquery-ui-rails'
|
16
|
+
|
17
|
+
And run `bundle install`;)
|
15
18
|
|
16
|
-
Packed and ready for the Asset pipeline :)
|
19
|
+
Packed and ready for use with the Asset pipeline :)
|
20
|
+
|
21
|
+
Add to javascript manifest file, fx `application.js`
|
17
22
|
|
18
23
|
```
|
24
|
+
//= require jquery_ujs
|
25
|
+
//= require jquery.ui.all
|
19
26
|
//= require gmaps-autocomplete
|
20
27
|
```
|
21
28
|
|
22
|
-
|
29
|
+
And include the google maps script before `application.js`, fx in your layout file:
|
30
|
+
|
31
|
+
See [google maps and RoR](http://stackoverflow.com/questions/7466872/google-maps-and-ror-3-1)
|
32
|
+
|
33
|
+
*application.html.erb*
|
34
|
+
|
35
|
+
```erb
|
36
|
+
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
|
37
|
+
<%= javascript_include_tag "application" %>
|
38
|
+
```
|
39
|
+
|
40
|
+
Note also that the autocomplete script depends on jQuery 1.6+.
|
41
|
+
|
42
|
+
## Initialize
|
43
|
+
|
44
|
+
*application.js*
|
23
45
|
|
24
46
|
```javascript
|
25
47
|
$(document).ready(function() {
|
@@ -27,10 +49,35 @@ $(document).ready(function() {
|
|
27
49
|
GmapsAutoComplete.autoCompleteInit();
|
28
50
|
});
|
29
51
|
```
|
52
|
+
or coffeescript
|
53
|
+
|
54
|
+
*yourmodel.js.coffee*
|
55
|
+
|
56
|
+
```
|
57
|
+
$ ->
|
58
|
+
GmapsAutoComplete.init()
|
59
|
+
GmapsAutoComplete.autoCompleteInit()
|
60
|
+
```
|
30
61
|
|
31
|
-
|
62
|
+
### Configuration options
|
32
63
|
|
33
|
-
`init()` take an option hash, using the following defaults:
|
64
|
+
`init()` can take an option hash, using the following defaults:
|
65
|
+
|
66
|
+
```javascript
|
67
|
+
defaultOptions = {
|
68
|
+
mapElem: "#gmaps-canvas",
|
69
|
+
zoomLevel: 2,
|
70
|
+
mapType: google.maps.MapTypeId.ROADMAP,
|
71
|
+
pos: [51.751724, -1.255284],
|
72
|
+
inputField: '#gmaps-input-address',
|
73
|
+
errorField: '#gmaps-error',
|
74
|
+
debugOn: false
|
75
|
+
};
|
76
|
+
```
|
77
|
+
|
78
|
+
### Advanced Configuration
|
79
|
+
|
80
|
+
`init()` can take an option hash, using the following defaults:
|
34
81
|
|
35
82
|
```javascript
|
36
83
|
defaultOptions = {
|
@@ -60,11 +107,18 @@ autoCompleteInit({region: 'DK', country: 'Denmark'});
|
|
60
107
|
|
61
108
|
Will make searches in the DK region and remove `', Denmark'` from the result.
|
62
109
|
|
63
|
-
|
110
|
+
## Use with Rails form helpers
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
= simple_form_for(@post) do |f|
|
114
|
+
= f.input :address, :input_html =>{:id => 'gmaps-input-address'}, :placeholder => 'Start typing a place...'
|
115
|
+
```
|
116
|
+
|
117
|
+
## Examples
|
64
118
|
|
65
119
|
See `spec/index.html` for an example page using this "plugin". Note that if you set `mapElem`to null or leave out that element on the page, the autocomplete will function without attempting to update the map :)
|
66
120
|
|
67
|
-
## Customization
|
121
|
+
## Advanced Customization
|
68
122
|
|
69
123
|
Some of the prime candidate functions for customization are:
|
70
124
|
|
@@ -94,7 +148,7 @@ updateUi: function( address, latLng ) {
|
|
94
148
|
}
|
95
149
|
```
|
96
150
|
|
97
|
-
##
|
151
|
+
## Customizing messages
|
98
152
|
|
99
153
|
For now, directly define your own implementation (override) the following functions directly on GmapsAutoComplete
|
100
154
|
|
@@ -119,6 +173,9 @@ For [formtastic](https://github.com/justinfrench/formtastic) something like:
|
|
119
173
|
= semantic_form_for @search do |f|
|
120
174
|
= f.input :address, placeholder: 'find address'
|
121
175
|
%span#address_error
|
176
|
+
```
|
177
|
+
|
178
|
+
And matching configuration in your javascript:
|
122
179
|
|
123
180
|
```javascript
|
124
181
|
$(document).ready(function() {
|
@@ -127,6 +184,8 @@ $(document).ready(function() {
|
|
127
184
|
});
|
128
185
|
```
|
129
186
|
|
187
|
+
Enjoy!
|
188
|
+
|
130
189
|
## TODO
|
131
190
|
|
132
191
|
* better Javascript encapsulation
|
@@ -144,7 +203,7 @@ Please help out with suggestions and improvements etc!
|
|
144
203
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
145
204
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
146
205
|
|
147
|
-
|
206
|
+
## Copyright
|
148
207
|
|
149
208
|
Copyright (c) 2012 Kristian Mandrup. See LICENSE.txt for
|
150
209
|
further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.2
|
1
|
+
0.1.2.1
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "gmaps-autocomplete-rails"
|
8
|
-
s.version = "0.1.2"
|
8
|
+
s.version = "0.1.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-03-04"
|
13
13
|
s.description = "Easily add autocomplete geo-functionality to your Rails app :)"
|
14
14
|
s.email = "kmandrup@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -54,33 +54,33 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.homepage = "http://github.com/kristianmandrup/gmaps-autocomplete-rails"
|
55
55
|
s.licenses = ["MIT"]
|
56
56
|
s.require_paths = ["lib"]
|
57
|
-
s.rubygems_version = "1.8.
|
57
|
+
s.rubygems_version = "1.8.25"
|
58
58
|
s.summary = "Google Maps v3 search with jQuery UI Autocomplete, ready for use with Rails asset pipeline"
|
59
59
|
|
60
60
|
if s.respond_to? :specification_version then
|
61
61
|
s.specification_version = 3
|
62
62
|
|
63
63
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
64
|
-
s.add_runtime_dependency(%q<rails>, [">= 3.
|
65
|
-
s.add_development_dependency(%q<rspec>, [">= 2.
|
64
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.1.0"])
|
65
|
+
s.add_development_dependency(%q<rspec>, [">= 2.9.0"])
|
66
66
|
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
67
|
-
s.add_development_dependency(%q<bundler>, [">= 1.
|
68
|
-
s.add_development_dependency(%q<jeweler>, ["
|
67
|
+
s.add_development_dependency(%q<bundler>, [">= 1.1.0"])
|
68
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
69
69
|
s.add_development_dependency(%q<simplecov>, [">= 0.5"])
|
70
70
|
else
|
71
|
-
s.add_dependency(%q<rails>, [">= 3.
|
72
|
-
s.add_dependency(%q<rspec>, [">= 2.
|
71
|
+
s.add_dependency(%q<rails>, [">= 3.1.0"])
|
72
|
+
s.add_dependency(%q<rspec>, [">= 2.9.0"])
|
73
73
|
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
74
|
-
s.add_dependency(%q<bundler>, [">= 1.
|
75
|
-
s.add_dependency(%q<jeweler>, ["
|
74
|
+
s.add_dependency(%q<bundler>, [">= 1.1.0"])
|
75
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
76
76
|
s.add_dependency(%q<simplecov>, [">= 0.5"])
|
77
77
|
end
|
78
78
|
else
|
79
|
-
s.add_dependency(%q<rails>, [">= 3.
|
80
|
-
s.add_dependency(%q<rspec>, [">= 2.
|
79
|
+
s.add_dependency(%q<rails>, [">= 3.1.0"])
|
80
|
+
s.add_dependency(%q<rspec>, [">= 2.9.0"])
|
81
81
|
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
82
|
-
s.add_dependency(%q<bundler>, [">= 1.
|
83
|
-
s.add_dependency(%q<jeweler>, ["
|
82
|
+
s.add_dependency(%q<bundler>, [">= 1.1.0"])
|
83
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
84
84
|
s.add_dependency(%q<simplecov>, [">= 0.5"])
|
85
85
|
end
|
86
86
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmaps-autocomplete-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.2
|
4
|
+
version: 0.1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.
|
21
|
+
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.
|
29
|
+
version: 3.1.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rspec
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 2.
|
37
|
+
version: 2.9.0
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.
|
45
|
+
version: 2.9.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rdoc
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.
|
69
|
+
version: 1.1.0
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,13 +74,13 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.
|
77
|
+
version: 1.1.0
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: jeweler
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: 1.8.4
|
86
86
|
type: :development
|
@@ -88,7 +88,7 @@ dependencies:
|
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: 1.8.4
|
94
94
|
- !ruby/object:Gem::Dependency
|
@@ -163,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
163
|
version: '0'
|
164
164
|
segments:
|
165
165
|
- 0
|
166
|
-
hash:
|
166
|
+
hash: 3294242176316535928
|
167
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
168
|
none: false
|
169
169
|
requirements:
|
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
174
|
rubyforge_project:
|
175
|
-
rubygems_version: 1.8.
|
175
|
+
rubygems_version: 1.8.25
|
176
176
|
signing_key:
|
177
177
|
specification_version: 3
|
178
178
|
summary: Google Maps v3 search with jQuery UI Autocomplete, ready for use with Rails
|