Skip to content

Commit

Permalink
Put latitude and longitude into DOM. [#3]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Dec 10, 2008
1 parent bc6367a commit 619dcce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/helpers/events_helper.rb
Expand Up @@ -69,6 +69,8 @@ def event_map(event, hostname)
@extra_headers << GMap.header(:host => hostname).to_s << map.to_html.to_s

result << info(event)
result << content_tag(:div, h(event.coords.lat), :id => :lat, :class => :hidden)
result << content_tag(:div, h(event.coords.lng), :id => :lng, :class => :hidden)
result << map.div(:width => 500, :height => 400)
=begin
@map = GMap.new(:map)
Expand Down
5 changes: 3 additions & 2 deletions spec/helpers/events_helper_spec.rb
Expand Up @@ -110,8 +110,9 @@
helper.should_receive(:info).with(event).at_least(:once).and_return(info_div)

map = helper.event_map(event, DOMAIN)
map.should have_tag('#gmap')
map.should have_tag('#info')
{'#gmap' => nil, '#info' => nil, '#lat' => ERB::Util::h(event.coords.lat), '#lng' => ERB::Util::h(event.coords.lng)}.each do |k, v|
map.should have_tag(k, v)
end
assigns[:extra_headers].should_not be_nil
assigns[:extra_headers].should include(gmap_header)
assigns[:extra_headers].should include(gmap.to_html.to_s)
Expand Down

0 comments on commit 619dcce

Please sign in to comment.