gmaps4rails 0.2.6 → 0.3.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.
- data/README.rdoc +7 -5
- data/lib/acts_as_gmappable/base.rb +7 -9
- data/lib/array.rb +1 -3
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -30,9 +30,9 @@ In your model, add:
|
|
30
30
|
|
31
31
|
Create a migration and add the following fields to your table (here users):
|
32
32
|
|
33
|
-
add_column :users, :latitude, :float
|
34
|
-
add_column :users, :longitude, :float
|
35
|
-
add_column :users, :gmaps, :boolean
|
33
|
+
add_column :users, :latitude, :float #you can change the name, see wiki
|
34
|
+
add_column :users, :longitude, :float #you can change the name, see wiki
|
35
|
+
add_column :users, :gmaps, :boolean #not mandatory, see wiki
|
36
36
|
|
37
37
|
== How to?
|
38
38
|
=== QuickStart!
|
@@ -65,11 +65,13 @@ Done again!
|
|
65
65
|
|
66
66
|
* Create from your own json
|
67
67
|
|
68
|
-
|
68
|
+
* Geocode directly your address and retrieve coordinates.
|
69
|
+
|
70
|
+
* {More details in the Wiki}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki]
|
69
71
|
|
70
72
|
== Todo?
|
71
73
|
|
72
|
-
Feel free ton contact us, you have your say.
|
74
|
+
Feel free ton contact us, you have your say.
|
73
75
|
|
74
76
|
== Copyright
|
75
77
|
MIT license. Authors: Benjamin Roth, David Ruyer
|
@@ -9,10 +9,10 @@ module Gmaps4rails
|
|
9
9
|
class GeocodeNetStatus < StandardError; end
|
10
10
|
|
11
11
|
def Gmaps4rails.create_json(object)
|
12
|
-
unless object.
|
12
|
+
unless object[object.gmaps4rails_options[:lat_column]].blank? && object[object.gmaps4rails_options[:lng_column]].blank?
|
13
13
|
"{\"description\": \"#{object.gmaps4rails_infowindow}\",
|
14
|
-
\"longitude\": \"#{object.
|
15
|
-
\"latitude\": \"#{object.
|
14
|
+
\"longitude\": \"#{object[object.gmaps4rails_options[:lng_column]]}\",
|
15
|
+
\"latitude\": \"#{object[object.gmaps4rails_options[:lat_column]]}\",
|
16
16
|
\"picture\": \"#{object.gmaps4rails_marker_picture['picture']}\",
|
17
17
|
\"width\": \"#{object.gmaps4rails_marker_picture['width']}\",
|
18
18
|
\"height\": \"#{object.gmaps4rails_marker_picture['height']}\"
|
@@ -54,7 +54,7 @@ module Gmaps4rails
|
|
54
54
|
end #end resp test
|
55
55
|
|
56
56
|
end # end address valid
|
57
|
-
end #end
|
57
|
+
end #end geocode
|
58
58
|
|
59
59
|
module ActsAsGmappable
|
60
60
|
|
@@ -73,8 +73,8 @@ module Gmaps4rails
|
|
73
73
|
|
74
74
|
define_method "gmaps4rails_options" do
|
75
75
|
{
|
76
|
-
:lat_column => args[:lat] || "
|
77
|
-
:lng_column => args[:lng] || "
|
76
|
+
:lat_column => args[:lat] || "latitude",
|
77
|
+
:lng_column => args[:lng] || "longitude",
|
78
78
|
:check_process => args[:check_process] || true,
|
79
79
|
:checker => args[:checker] || "gmaps",
|
80
80
|
:msg => args[:msg] || "Address invalid",
|
@@ -123,9 +123,7 @@ module Gmaps4rails
|
|
123
123
|
|
124
124
|
def to_gmaps4rails
|
125
125
|
json = "["
|
126
|
-
|
127
|
-
json += Gmaps4rails.create_json(self).to_s
|
128
|
-
end
|
126
|
+
json += Gmaps4rails.create_json(self).to_s
|
129
127
|
json.chop! #removes the extra comma
|
130
128
|
json += "]"
|
131
129
|
end
|
data/lib/array.rb
CHANGED
@@ -2,9 +2,7 @@ class Array
|
|
2
2
|
def to_gmaps4rails
|
3
3
|
json = "["
|
4
4
|
each do |object|
|
5
|
-
|
6
|
-
json += Gmaps4rails.create_json(object).to_s
|
7
|
-
end
|
5
|
+
json += Gmaps4rails.create_json(object).to_s
|
8
6
|
end
|
9
7
|
json.chop!
|
10
8
|
json += "]"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmaps4rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benjamin Roth
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-17 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -64,7 +64,7 @@ files:
|
|
64
64
|
- test/test_helper.rb
|
65
65
|
- test/unit/gmaps4rails_widget_test.rb
|
66
66
|
has_rdoc: true
|
67
|
-
homepage: http://github.com/apneadiving/
|
67
|
+
homepage: http://github.com/apneadiving/Google-Maps-for-Rails
|
68
68
|
licenses: []
|
69
69
|
|
70
70
|
post_install_message:
|