Rename
This commit is contained in:
parent
df6689ddf5
commit
cc07af72fb
|
@ -1,4 +1,4 @@
|
||||||
class FormsController < ApplicationController
|
class ContentsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@hydrant = Hydrant.find_by_id(params[:hydrant_id])
|
@hydrant = Hydrant.find_by_id(params[:hydrant_id])
|
||||||
if @hydrant.adopted?
|
if @hydrant.adopted?
|
|
@ -1,4 +1,4 @@
|
||||||
<%= form_for @hydrant, :remote => true, :html => {:id => "adoption_form"} do |f| %>
|
<%= form_for @hydrant, :html => {:id => "adoption_form"} do |f| %>
|
||||||
<h2>Adopt this Hydrant</h2>
|
<h2>Adopt this Hydrant</h2>
|
||||||
<div id="adoption_fields">
|
<div id="adoption_fields">
|
||||||
<%= f.hidden_field "id" %>
|
<%= f.hidden_field "id" %>
|
|
@ -1,4 +1,4 @@
|
||||||
<%= form_for :user, :remote => true, :html => {:id => "combo_form"} do |f| %>
|
<%= form_for :user, :html => {:id => "combo_form"} do |f| %>
|
||||||
<h2>Adopt this Hydrant</h2>
|
<h2>Adopt this Hydrant</h2>
|
||||||
<div id="common_fields">
|
<div id="common_fields">
|
||||||
<%= f.label "email", "Email address", :id => "user_email_label" %>
|
<%= f.label "email", "Email address", :id => "user_email_label" %>
|
|
@ -1,17 +1,14 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
var center = new google.maps.LatLng(42.358431, -71.059773);
|
var center = new google.maps.LatLng(42.358431, -71.059773);
|
||||||
var southWest;
|
|
||||||
var northEast;
|
|
||||||
var bounds;
|
|
||||||
var zoomLevel = 15;
|
var zoomLevel = 15;
|
||||||
var myOptions = {
|
var mapOptions = {
|
||||||
center: center,
|
center: center,
|
||||||
mapTypeControl: false,
|
mapTypeControl: false,
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||||
panControl: false,
|
panControl: false,
|
||||||
zoom: zoomLevel
|
zoom: zoomLevel
|
||||||
};
|
};
|
||||||
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
|
||||||
var activeHydrantId;
|
var activeHydrantId;
|
||||||
var activeMarker;
|
var activeMarker;
|
||||||
var activeInfoWindow;
|
var activeInfoWindow;
|
||||||
|
@ -41,7 +38,7 @@ $(function() {
|
||||||
if(activeInfoWindow) {
|
if(activeInfoWindow) {
|
||||||
activeInfoWindow.close();
|
activeInfoWindow.close();
|
||||||
}
|
}
|
||||||
$.get('<%= forms_path %>', {
|
$.get('<%= contents_path %>', {
|
||||||
'hydrant_id': hydrantId
|
'hydrant_id': hydrantId
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
var infoWindow = new google.maps.InfoWindow({
|
var infoWindow = new google.maps.InfoWindow({
|
||||||
|
@ -58,9 +55,9 @@ $(function() {
|
||||||
}
|
}
|
||||||
function addMarkersAround(lat, lng) {
|
function addMarkersAround(lat, lng) {
|
||||||
$.get('<%= hydrants_path :format => "json" %>', {
|
$.get('<%= hydrants_path :format => "json" %>', {
|
||||||
'commit': $('#location_submit').val(),
|
'commit': $('#address_submit').val(),
|
||||||
'utf8': '✓',
|
'utf8': '✓',
|
||||||
'authenticity_token': $('#location_form input[name="authenticity_token"]').val(),
|
'authenticity_token': $('#address_form input[name="authenticity_token"]').val(),
|
||||||
'lat': lat,
|
'lat': lat,
|
||||||
'lng': lng
|
'lng': lng
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
|
@ -108,16 +105,16 @@ $(function() {
|
||||||
center = map.getCenter();
|
center = map.getCenter();
|
||||||
addMarkersAround(center.lat(), center.lng());
|
addMarkersAround(center.lat(), center.lng());
|
||||||
});
|
});
|
||||||
$('#location_form').submit(function() {
|
$('#address_form').submit(function() {
|
||||||
if($('#address').val() === '') {
|
if($('#address').val() === '') {
|
||||||
$('#address_label').addClass('error', 500);
|
$('#address_label').addClass('error', 500);
|
||||||
$('#address').addClass('error', 500);
|
$('#address').addClass('error', 500);
|
||||||
$('#address').focus();
|
$('#address').focus();
|
||||||
} else {
|
} else {
|
||||||
$.get('<%= address_path :format => "json" %>', {
|
$.get('<%= address_path :format => "json" %>', {
|
||||||
'commit': $('#location_submit').val(),
|
'commit': $('#address_submit').val(),
|
||||||
'utf8': '✓',
|
'utf8': '✓',
|
||||||
'authenticity_token': $('#location_form input[name="authenticity_token"]').val(),
|
'authenticity_token': $('#address_form input[name="authenticity_token"]').val(),
|
||||||
'city_state': $('#city_state').val(),
|
'city_state': $('#city_state').val(),
|
||||||
'address': $('#address').val()
|
'address': $('#address').val()
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
|
@ -234,7 +231,7 @@ $(function() {
|
||||||
}
|
}
|
||||||
errors[0].focus();
|
errors[0].focus();
|
||||||
} else {
|
} else {
|
||||||
$.get('<%= forms_path %>', {
|
$.get('<%= contents_path %>', {
|
||||||
'hydrant_id': activeHydrantId
|
'hydrant_id': activeHydrantId
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
activeInfoWindow.setContent(data);
|
activeInfoWindow.setContent(data);
|
||||||
|
@ -269,7 +266,7 @@ $(function() {
|
||||||
$('#user_password').addClass('error', 500);
|
$('#user_password').addClass('error', 500);
|
||||||
$('#user_password').focus();
|
$('#user_password').focus();
|
||||||
} else {
|
} else {
|
||||||
$.get('<%= forms_path %>', {
|
$.get('<%= contents_path %>', {
|
||||||
'hydrant_id': activeHydrantId
|
'hydrant_id': activeHydrantId
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
activeInfoWindow.setContent(data);
|
activeInfoWindow.setContent(data);
|
||||||
|
@ -314,7 +311,7 @@ $(function() {
|
||||||
'name': $('#hydrant_name').val()
|
'name': $('#hydrant_name').val()
|
||||||
}
|
}
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$.get('<%= forms_path %>', {
|
$.get('<%= contents_path %>', {
|
||||||
'hydrant_id': activeHydrantId
|
'hydrant_id': activeHydrantId
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
activeInfoWindow.setContent(data);
|
activeInfoWindow.setContent(data);
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
<p id="tagline">
|
<p id="tagline">
|
||||||
Claim responsibility for shoveling out a fire hydrant after it snows.
|
Claim responsibility for shoveling out a fire hydrant after it snows.
|
||||||
</p>
|
</p>
|
||||||
<%= form_tag "/", :method => "GET", :id => "location_form" do %>
|
<%= form_for :address, :html => {:id => "address_form"} do |f| %>
|
||||||
<%= label_tag "city_state", "City", :id => "city_label" %>
|
<%= label_tag "city_state", "City", :id => "city_label" %>
|
||||||
<%= select_tag "city_state", '<option value="Boston, MA" selected="selected">Boston, MA</option>'.html_safe, :tabindex => 10 %>
|
<%= select_tag "city_state", '<option value="Boston, MA" selected="selected">Boston, MA</option>'.html_safe, :tabindex => 10 %>
|
||||||
<%= label_tag "address", "Address", :id => "address_label" %>
|
<%= label_tag "address", "Address", :id => "address_label" %>
|
||||||
<%= text_field_tag "address", params[:address], :tabindex => 11 %>
|
<%= text_field_tag "address", params[:address], :tabindex => 11 %>
|
||||||
<%= submit_tag "Find Fire Hydrants", :id => "location_submit", :tabindex => 12 %>
|
<%= submit_tag "Find Fire Hydrants", :id => "address_submit", :tabindex => 12 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div id="logos">
|
<div id="logos">
|
||||||
<%= image_tag "logos/cfa.png", :alt => "Code for America", :title => "Code for America" %>
|
<%= image_tag "logos/cfa.png", :alt => "Code for America", :title => "Code for America" %>
|
||||||
|
|
|
@ -12,6 +12,6 @@ AdoptAHydrant::Application.routes.draw do
|
||||||
end
|
end
|
||||||
get 'address' => 'addresses#index', :as => 'address'
|
get 'address' => 'addresses#index', :as => 'address'
|
||||||
get 'sitemap' => 'sitemaps#index', :as => 'sitemap'
|
get 'sitemap' => 'sitemaps#index', :as => 'sitemap'
|
||||||
get 'forms' => 'forms#index', :as => 'forms'
|
get 'contents' => 'contents#index', :as => 'contents'
|
||||||
root :to => 'main#index'
|
root :to => 'main#index'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue