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';
|
|
|
|
<% @hydrants.each do |hydrant| %>
|
2011-03-01 04:13:31 +00:00
|
|
|
<% if user = hydrant.user %>
|
|
|
|
<% require 'digest/md5' %>
|
|
|
|
<% hash = Digest::MD5.hexdigest(user.email) %>
|
|
|
|
var contentString = '\
|
|
|
|
<h2>Adopted by <%= hydrant.user.name %></h2>\
|
|
|
|
<a class="button">Email a reminder to shovel</a>\
|
|
|
|
'
|
|
|
|
<% else %>
|
|
|
|
var contentString = '\
|
|
|
|
<div class="box">\
|
|
|
|
<h2>Adopt this Hydrant</h2>\
|
|
|
|
<%= form_tag do %>\
|
|
|
|
<div class="common_fields">\
|
|
|
|
<%= label_tag "email" %>\
|
|
|
|
<%= text_field_tag "email", params[:email], :tabindex => 1 %>\
|
|
|
|
<%= label_tag "account_new" , radio_button_tag("account", "new", true, :tabindex => 2).html_safe + "I haven\\'t signed up yet" %><br />\
|
|
|
|
<%= label_tag "account_existing", radio_button_tag("account", "existing").html_safe + "I already signed up" %><br />\
|
|
|
|
</div>\
|
|
|
|
<div class="account_new_fields">\
|
|
|
|
<%= label_tag "name" %>\
|
|
|
|
<%= text_field_tag "name", params[:name], :tabindex => 3 %>\
|
|
|
|
<%= label_tag "organization" %>\
|
|
|
|
<%= text_field_tag "organization", params[:organization], :tabindex => 4 %>\
|
|
|
|
<%= label_tag "voice_number" %>\
|
|
|
|
<%= text_field_tag "voice_number", params[:voice_number], :tabindex => 5 %>\
|
|
|
|
<%= label_tag "sms_number", "SMS number" %>\
|
|
|
|
<%= text_field_tag "sms_number", params[:sms_number], :tabindex => 6 %>\
|
|
|
|
<%= label_tag "password", "Choose a password" %>\
|
|
|
|
<%= password_field_tag "password", nil, :tabindex => 7 %>\
|
|
|
|
<%= submit_tag "Sign up", :tabindex => 8 %>\
|
|
|
|
<p>By signing up you accept the <%= link_to "Terms of Service", "#", :tabindex => 9 %>.</p>\
|
|
|
|
</div>\
|
|
|
|
<div class="account_existing_fields" style="display: none;">\
|
|
|
|
<%= label_tag "password" %>\
|
|
|
|
<%= password_field_tag "password", nil, :tabindex => 0 %>\
|
|
|
|
<%= label_tag "remember_me", check_box_tag("remember_me", nil, true).html_safe + "Stay signed in" %><br />\
|
|
|
|
<%= submit_tag "Sign in", :tabindex => 0 %>\
|
|
|
|
<p><%= link_to "Forgot your password?", "#", :class => "forgot_password", :tabindex => 0 %></p>\
|
|
|
|
</div>\
|
|
|
|
<div class="forgot_password_fields" style="display: none;">\
|
|
|
|
<%= submit_tag "Email me my password", :tabindex => 0 %>\
|
|
|
|
<p><%= link_to "Never mind. I remembered my password.", "#", :class => "remembered_password", :tabindex => 0 %></p>\
|
|
|
|
</div>\
|
|
|
|
<% end %>\
|
|
|
|
</div>\
|
|
|
|
';
|
|
|
|
<% end %>
|
|
|
|
var h<%= hydrant.id %>InfoWindow = new google.maps.InfoWindow({
|
|
|
|
content: contentString
|
|
|
|
});
|
|
|
|
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 04:13:31 +00:00
|
|
|
google.maps.event.addListener(h<%= hydrant.id %>Marker, 'click', function() {
|
|
|
|
<% @hydrants.each do |hydrant| %>
|
|
|
|
h<%= hydrant.id %>InfoWindow.close();
|
|
|
|
<% end %>
|
|
|
|
h<%= hydrant.id %>InfoWindow.open(map, h<%= hydrant.id %>Marker);
|
|
|
|
});
|
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>
|