Skip to content

Commit

Permalink
I moved the loading of the map to globalMap.js where it is defined as a
Browse files Browse the repository at this point in the history
global vairiable, accessible to both the map.js (which I should rename
search) and parks.js (which draws the parks on the map).
  • Loading branch information
Ashleigh Baumgardner committed Jun 30, 2010
1 parent 848cd4e commit f1d159c
Show file tree
Hide file tree
Showing 8 changed files with 492 additions and 11 deletions.
8 changes: 8 additions & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
class HomeController < ApplicationController
def index
@parks = Park.find(:all).collect do |p|
{"id" => p.id,
"url" => p.site_url,
"latitude" => p.latitude,
"longitude" => p.longitude,
"name" => p.name
}
end
end

end
13 changes: 12 additions & 1 deletion app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@

<div id="container">
<h1> Welcome! I hope this app can service all you park needs </h1>
<p> Basically, </p>
<p> A while back I was trying to plan a bicycle tour to visit national parks.
I searched and searched for a simple map with all of the national parks
labeled, but I never found anything useful. My planned trip no longer involves
visiting all of the national parks, but I still thought this might be useful
to someone. </p>
<div id="add_park">
<input id="addParkButton" type="button" value="Add a Park?"/>
</div>
<script type="text/javascript">
var parks = <%= @parks.to_json %>;
</script>

<div>
<input type="text" id="queryInput" value="pizza" style="width: 250px;"/>
<input id="dosearch" type="button" value="Find"/>
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<%= stylesheet_link_tag 'base' %>
<%= javascript_include_tag 'globalMap' %>
<%= javascript_include_tag 'map' %>
<%= javascript_include_tag 'parks' %>

</head>
<body>
Expand Down
Binary file modified db/development.sqlite3
Binary file not shown.
Loading

0 comments on commit f1d159c

Please sign in to comment.