adopt-a-hydrant/app/views/layouts/application.html.erb

76 lines
2.8 KiB
Plaintext
Raw Normal View History

2011-02-14 18:28:51 +00:00
<!DOCTYPE html>
<html>
2011-02-14 18:49:00 +00:00
<head>
2011-02-23 22:24:08 +00:00
<title>Adopt a Hydrant</title>
2011-02-14 18:49:00 +00:00
<%= stylesheet_link_tag "main" %>
2011-02-14 20:27:18 +00:00
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" %>
2011-02-14 18:49:00 +00:00
<%= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false" %>
2011-02-25 20:34:39 +00:00
<%= javascript_include_tag "snowstorm" %>
2011-02-25 21:34:01 +00:00
<script type="text/javascript">
$(function() {
var map;
var latlng = new google.maps.LatLng(<%= @lat %>, <%= @lng %>);
var myOptions = {
zoom: <%= @zoom %>,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
2011-02-25 21:49:45 +00:00
var redMarker = '/images/markers/red.png';
var greenMarker = '/images/markers/green.png';
2011-03-01 05:11:07 +00:00
var openInfoWindow;
2011-03-01 06:42:16 +00:00
var formString = '<%= render(:partial => "adoption_form").gsub("\n", "") %>'
2011-03-01 05:11:07 +00:00
<% @hydrants.each do |hydrant| %>
<% if user = hydrant.user %>
2011-03-01 06:42:16 +00:00
var contentString = '<%= render(:partial => "user_profile", :locals => {:user => user}).gsub("\n", "") %>'
2011-03-01 05:11:07 +00:00
<% else %>
var contentString = formString;
2011-03-01 04:13:31 +00:00
<% end %>
var h<%= hydrant.id %>LatLng = new google.maps.LatLng(<%= hydrant.lat %>, <%= hydrant.lng %>);
var h<%= hydrant.id %>Marker = new google.maps.Marker({
position: h<%= hydrant.id %>LatLng,
2011-02-25 21:49:45 +00:00
map: map,
icon: <%= hydrant.user_id ? "greenMarker" : "redMarker" %>
});
2011-03-01 05:11:07 +00:00
var h<%= hydrant.id %>InfoWindow = new google.maps.InfoWindow({
content: contentString
});
2011-03-01 04:13:31 +00:00
google.maps.event.addListener(h<%= hydrant.id %>Marker, 'click', function() {
2011-03-01 05:11:07 +00:00
if(openInfoWindow) {
openInfoWindow.close();
}
2011-03-01 04:13:31 +00:00
h<%= hydrant.id %>InfoWindow.open(map, h<%= hydrant.id %>Marker);
2011-03-01 05:11:07 +00:00
openInfoWindow = h<%= hydrant.id %>InfoWindow;
2011-03-01 04:13:31 +00:00
});
2011-02-25 21:49:45 +00:00
<% end %>
2011-03-01 04:13:31 +00:00
$('.box input[type="radio"]').live('click', function() {
var self = $(this);
if('new' == self.val()) {
$('.forgot_password_fields').slideUp();
$('.account_existing_fields').slideUp();
$('.account_new_fields').slideDown();
} else if('existing' == self.val()) {
$('.account_new_fields').slideUp();
$('.account_existing_fields').slideDown(function() {
$('.forgot_password').click(function() {
$('.account_existing_fields').slideUp();
$('.forgot_password_fields').slideDown(function() {
$('.remembered_password').click(function() {
$('.forgot_password_fields').slideUp();
$('.account_existing_fields').slideDown();
});
});
});
});
}
});
2011-02-25 21:34:01 +00:00
})
</script>
2011-02-14 18:49:00 +00:00
<%= csrf_meta_tag %>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
</head>
2011-02-14 20:27:18 +00:00
<body>
2011-02-14 18:49:00 +00:00
<%= yield -%>
</body>
2011-02-14 18:28:51 +00:00
</html>