geo_contrast 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +60 -9
- data/lib/geo_contrast/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4683e82af6440462adac2486f460c25f66949f48
|
4
|
+
data.tar.gz: f13e132f69f6bc3862e807dd3c38456e253fed9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f40da18cba0246c943c05fa147545991ce047c4466be2a496dbdb05c6a100e0494469243835a92ec82ed65254f60ace8c5299bbcb714b63c857f4f2d628c9d92
|
7
|
+
data.tar.gz: 014270e976bf346562481937f2778a6fce9133209ed1420946b6b18e701508667446e6b136d5ddc343f2586299b3ae0b84841ef7f916a918e9262583a52eeb0c
|
data/MIT-LICENSE
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2009-2014 CODELAND. http://codeland.com.br
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# GeoContrast
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
2
|
+
GeoContrast allows you to transform a simple text field in a Google Maps Autocomplete search field, bringing the name of streets, cities or an establishments.
|
4
3
|
|
5
4
|
## Installation
|
5
|
+
Install it yourself as:
|
6
|
+
|
7
|
+
$ gem install geo_contrast
|
6
8
|
|
7
|
-
|
9
|
+
Or add this line to your application's Gemfile:
|
8
10
|
|
9
11
|
```ruby
|
10
12
|
gem 'geo_contrast'
|
@@ -14,17 +16,66 @@ And then execute:
|
|
14
16
|
|
15
17
|
$ bundle
|
16
18
|
|
17
|
-
|
19
|
+
## Usage
|
20
|
+
In `application.js` insert the following line:
|
18
21
|
|
19
|
-
|
22
|
+
```javascript
|
23
|
+
//= require geo_contrast
|
24
|
+
```
|
20
25
|
|
21
|
-
|
26
|
+
Inside `application.html.erb` call the Google Places Autocomplete:
|
22
27
|
|
23
|
-
|
28
|
+
```erb
|
29
|
+
<%= javascript_include_tag 'application', '//maps.googleapis.com/maps/api/js?libraries=places','data-turbolinks-track' => true %>
|
30
|
+
```
|
24
31
|
|
25
|
-
|
32
|
+
Then, inside your form just add a class (or id) to your input field and inside `application.js` call the `GeoContrast` initialize function:
|
33
|
+
|
34
|
+
```javascript
|
35
|
+
$('.your_class').geoContrast();
|
36
|
+
```
|
37
|
+
|
38
|
+
## Customizing the results
|
39
|
+
|
40
|
+
You have a few options to customize the return address from Google.
|
41
|
+
You can specify the kind of search with this options:
|
26
42
|
|
27
|
-
|
43
|
+
### Format
|
44
|
+
With this it returns the short address. Eg. "San Francisco":
|
45
|
+
```javascript
|
46
|
+
$('.your_class').geoContrast({format: "short"});
|
47
|
+
```
|
48
|
+
This one returns the long version of the address. Eg. "San Francisco, California, United States of America":
|
49
|
+
```javascript
|
50
|
+
$('.your_class').geoContrast({format: "formatted"});
|
51
|
+
```
|
52
|
+
|
53
|
+
### Gmaps Options
|
54
|
+
|
55
|
+
If you want to search just for cities, for example, you can pass a option to specify this:
|
56
|
+
```javascript
|
57
|
+
$('.your_class').geoContrast({format: "long", options_gmaps: {types: ['(cities)']}});
|
58
|
+
```
|
59
|
+
|
60
|
+
## ROADMAP
|
61
|
+
|
62
|
+
Here is the next things that will be (probably) implemented:
|
63
|
+
|
64
|
+
1. Better way to handle coordinate fields (latitude, longitude)
|
65
|
+
2. Find a way to put Google Maps easily
|
66
|
+
3. Easy integration with SimpleForm
|
67
|
+
|
68
|
+
**...and more**
|
69
|
+
|
70
|
+
The options are:
|
71
|
+
|
72
|
+
1. 'geocode' -> For addresses.
|
73
|
+
2. '(regions)' -> For administrative regions.
|
74
|
+
3. 'establishment' -> For businesses.
|
75
|
+
4. '(cities)' -> For just city names.
|
76
|
+
|
77
|
+
## Contributing
|
78
|
+
1. Fork it ( https://github.com/codelandev/geo-contrast/fork )
|
28
79
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
80
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
81
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/geo_contrast/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo_contrast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CODELAND
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,8 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
55
|
+
description: GeoContrast allows you to transform a simple text field in a Google Maps
|
56
|
+
Autocomplete search field, bringing the name of streets, cities or an establishments.
|
56
57
|
email:
|
57
58
|
- contato@codeland.com.br
|
58
59
|
executables: []
|
@@ -64,7 +65,7 @@ files:
|
|
64
65
|
- lib/geo_contrast.rb
|
65
66
|
- lib/geo_contrast/version.rb
|
66
67
|
- vendor/assets/javascripts/geo_contrast.js
|
67
|
-
homepage: https://github.com/codelandev/
|
68
|
+
homepage: https://github.com/codelandev/geo-contrast
|
68
69
|
licenses:
|
69
70
|
- MIT
|
70
71
|
metadata: {}
|
@@ -87,5 +88,6 @@ rubyforge_project:
|
|
87
88
|
rubygems_version: 2.2.2
|
88
89
|
signing_key:
|
89
90
|
specification_version: 4
|
90
|
-
summary:
|
91
|
+
summary: GeoContrast allows you to transform a simple text field in a Google Maps
|
92
|
+
Autocomplete search field, bringing the name of streets, cities or an establishments.
|
91
93
|
test_files: []
|