google_maps_rails 1.0.3 → 1.1.0
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/.gitignore +1 -0
- data/README.md +13 -6
- data/google_maps_rails.gemspec +2 -2
- data/lib/google_maps_rails/version.rb +1 -1
- data/lib/google_maps_rails/view_helpers.rb +17 -4
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ab0ee7a7b2e1c2b546ffa8038dc2ee3c042fc1e
|
4
|
+
data.tar.gz: 96f2e1e08d83a9d1b0d5b05b0b815cc6f1d16fa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 968201bae93493b52db2dfe5c36a1b4c2fe54761fe942596767a178bd6ef9e46a72979426f812ff974bba07b5b261fa2db003fd66a4cdde29e05a9577e41c192
|
7
|
+
data.tar.gz: 794033fdaacfa2cbf8febf416a25520c0c96960858d712bd9cf8db447c847ff475a39fba503c45969e3d3e965e80f508dbcbe489fa1d41bec521c318b58e6b41
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -23,15 +23,22 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
Add the code in local where you want embed the map.
|
26
|
+
Add the code, and create attributes, in local where you want embed the map.
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
| Attribute | Type | Default value |
|
29
|
+
| --- | --- | --- |
|
30
|
+
| lat | String | nil |
|
31
|
+
| lat | String | nil |
|
32
|
+
| address | String | nil |
|
33
|
+
| width | String | 500 |
|
34
|
+
| height | String | 500 |
|
32
35
|
|
33
36
|
```ruby
|
34
|
-
|
37
|
+
# Lat and Long
|
38
|
+
embed_google_maps(lat: '-20.262197', long: '-54.799805')
|
39
|
+
|
40
|
+
# Address
|
41
|
+
embed_google_maps(address: 'address name and number')
|
35
42
|
```
|
36
43
|
|
37
44
|
## license
|
data/google_maps_rails.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_development_dependency 'rails'
|
21
|
-
spec.add_development_dependency
|
20
|
+
spec.add_development_dependency 'rails', '~> 0'
|
21
|
+
spec.add_development_dependency 'rspec', '~> 0'
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.8"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
end
|
@@ -1,11 +1,24 @@
|
|
1
1
|
module GoogleMapsRails
|
2
2
|
module ViewHelpers
|
3
|
-
def embed_google_maps(
|
4
|
-
|
5
|
-
|
3
|
+
def embed_google_maps(options = {})
|
4
|
+
width = options[:width] || 500
|
5
|
+
height = options[:height] || 500
|
6
|
+
lat = options[:lat] || nil
|
7
|
+
long = options[:long] || nil
|
8
|
+
address = options[:address] || nil
|
9
|
+
|
10
|
+
if options[:lat] && options[:long]
|
11
|
+
"<iframe src='https://maps.google.com/maps?q=#{lat},#{long}&output=embed' frameborder='0' style='border:0' width='#{width}' height='#{height}' allowfullscreen></iframe>"
|
12
|
+
elsif options[:address]
|
13
|
+
"<iframe src='https://maps.google.com/maps?q=#{prepare_address(address)}&output=embed' frameborder='0' style='border:0' width='#{width}' height='#{height}' allowfullscreen></iframe>"
|
6
14
|
else
|
7
|
-
"latitude or
|
15
|
+
"latitude, longitude or address not found. See documentation"
|
8
16
|
end
|
9
17
|
end
|
18
|
+
|
19
|
+
def prepare_address(address)
|
20
|
+
address.gsub!(',', '%2C')
|
21
|
+
address.gsub!(' ', '%20')
|
22
|
+
end
|
10
23
|
end
|
11
24
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_maps_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luiz Picolo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.5.1
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Rails helper for embed Google Maps.
|