ipdb 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/ipdb/map.rb +38 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/lib/ipdb/map.rb
CHANGED
@@ -40,9 +40,28 @@ module Ipdb
|
|
40
40
|
#
|
41
41
|
# Return a Google Map for a Query Object
|
42
42
|
#
|
43
|
+
# @params [Boolean] js ('true') Exclude js with map if false.
|
44
|
+
#
|
43
45
|
# @return [String<HTML, JavaScript>] map The Google Map html and JavaScript.
|
44
46
|
#
|
45
|
-
def render
|
47
|
+
def render(js=true)
|
48
|
+
@map = ""; @id = 0
|
49
|
+
@xml.each do |x|
|
50
|
+
location = Location.new(x, @timeout)
|
51
|
+
id = "ip_#{@id += 1}_id"
|
52
|
+
@start = new_location(location.latitude, location.longitude) if @id == 1
|
53
|
+
@map += add_marker(id, location.address, location.latitude, location.longitude)
|
54
|
+
@map += add_window(id, location.address, location.city, location.country)
|
55
|
+
@map += add_listener(id)
|
56
|
+
end
|
57
|
+
if js
|
58
|
+
build_map(@start, @map)
|
59
|
+
else
|
60
|
+
build_map_without_js(@start, @map)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def render_js
|
46
65
|
@map = ""; @id = 0
|
47
66
|
@xml.each do |x|
|
48
67
|
location = Location.new(x, @timeout)
|
@@ -52,7 +71,11 @@ module Ipdb
|
|
52
71
|
@map += add_window(id, location.address, location.city, location.country)
|
53
72
|
@map += add_listener(id)
|
54
73
|
end
|
55
|
-
|
74
|
+
build_map_just_js(@start, @map)
|
75
|
+
end
|
76
|
+
|
77
|
+
def render_div
|
78
|
+
"<div id='#{@div_id}' class='#{@div_class}' style='width: #{@width}#{@units}; height: #{@height}#{@units}'></div>"
|
56
79
|
end
|
57
80
|
|
58
81
|
private
|
@@ -130,6 +153,19 @@ module Ipdb
|
|
130
153
|
<div id="#{@div_id}" class="#{@div_class}" style="width: #{@width}#{@units}; height: #{@height}#{@units}"></div>
|
131
154
|
EOF
|
132
155
|
end
|
156
|
+
|
157
|
+
def build_map_without_js(start, data)
|
158
|
+
return <<-EOF
|
159
|
+
<script type="text/javascript">function ipdb() {#{build_options(start)}#{data}};google.setOnLoadCallback(ipdb);</script>
|
160
|
+
<div id="#{@div_id}" class="#{@div_class}" style="width: #{@width}#{@units}; height: #{@height}#{@units}"></div>
|
161
|
+
EOF
|
162
|
+
end
|
163
|
+
|
164
|
+
def build_map_just_js(start, data)
|
165
|
+
return <<-EOF
|
166
|
+
<script type="text/javascript">function ipdb() {#{build_options(start)}#{data}};google.setOnLoadCallback(ipdb);</script>
|
167
|
+
EOF
|
168
|
+
end
|
133
169
|
|
134
170
|
end
|
135
171
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Willis Webber
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-29 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|