diff --git a/app/controllers/forms_controller.rb b/app/controllers/contents_controller.rb similarity index 89% rename from app/controllers/forms_controller.rb rename to app/controllers/contents_controller.rb index be005c9..d670dfd 100644 --- a/app/controllers/forms_controller.rb +++ b/app/controllers/contents_controller.rb @@ -1,4 +1,4 @@ -class FormsController < ApplicationController +class ContentsController < ApplicationController def index @hydrant = Hydrant.find_by_id(params[:hydrant_id]) if @hydrant.adopted? diff --git a/app/views/forms/_adoption_form.html.erb b/app/views/contents/_adoption_form.html.erb similarity index 85% rename from app/views/forms/_adoption_form.html.erb rename to app/views/contents/_adoption_form.html.erb index 45b4ffd..6d3dec5 100644 --- a/app/views/forms/_adoption_form.html.erb +++ b/app/views/contents/_adoption_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for @hydrant, :remote => true, :html => {:id => "adoption_form"} do |f| %> +<%= form_for @hydrant, :html => {:id => "adoption_form"} do |f| %>

Adopt this Hydrant

<%= f.hidden_field "id" %> diff --git a/app/views/forms/_combo_form.html.erb b/app/views/contents/_combo_form.html.erb similarity index 96% rename from app/views/forms/_combo_form.html.erb rename to app/views/contents/_combo_form.html.erb index ccfe922..1113ff3 100644 --- a/app/views/forms/_combo_form.html.erb +++ b/app/views/contents/_combo_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for :user, :remote => true, :html => {:id => "combo_form"} do |f| %> +<%= form_for :user, :html => {:id => "combo_form"} do |f| %>

Adopt this Hydrant

<%= f.label "email", "Email address", :id => "user_email_label" %> diff --git a/app/views/forms/_thank_you.html.erb b/app/views/contents/_thank_you.html.erb similarity index 100% rename from app/views/forms/_thank_you.html.erb rename to app/views/contents/_thank_you.html.erb diff --git a/app/views/forms/_user_profile.html.erb b/app/views/contents/_user_profile.html.erb similarity index 100% rename from app/views/forms/_user_profile.html.erb rename to app/views/contents/_user_profile.html.erb diff --git a/app/views/javascripts/main.js.erb b/app/views/javascripts/main.js.erb index 0488d50..66e8446 100644 --- a/app/views/javascripts/main.js.erb +++ b/app/views/javascripts/main.js.erb @@ -1,17 +1,14 @@ $(function() { var center = new google.maps.LatLng(42.358431, -71.059773); - var southWest; - var northEast; - var bounds; var zoomLevel = 15; - var myOptions = { + var mapOptions = { center: center, mapTypeControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP, panControl: false, 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 activeMarker; var activeInfoWindow; @@ -41,7 +38,7 @@ $(function() { if(activeInfoWindow) { activeInfoWindow.close(); } - $.get('<%= forms_path %>', { + $.get('<%= contents_path %>', { 'hydrant_id': hydrantId }, function(data) { var infoWindow = new google.maps.InfoWindow({ @@ -58,9 +55,9 @@ $(function() { } function addMarkersAround(lat, lng) { $.get('<%= hydrants_path :format => "json" %>', { - 'commit': $('#location_submit').val(), + 'commit': $('#address_submit').val(), 'utf8': '✓', - 'authenticity_token': $('#location_form input[name="authenticity_token"]').val(), + 'authenticity_token': $('#address_form input[name="authenticity_token"]').val(), 'lat': lat, 'lng': lng }, function(data) { @@ -108,16 +105,16 @@ $(function() { center = map.getCenter(); addMarkersAround(center.lat(), center.lng()); }); - $('#location_form').submit(function() { + $('#address_form').submit(function() { if($('#address').val() === '') { $('#address_label').addClass('error', 500); $('#address').addClass('error', 500); $('#address').focus(); } else { $.get('<%= address_path :format => "json" %>', { - 'commit': $('#location_submit').val(), + 'commit': $('#address_submit').val(), 'utf8': '✓', - 'authenticity_token': $('#location_form input[name="authenticity_token"]').val(), + 'authenticity_token': $('#address_form input[name="authenticity_token"]').val(), 'city_state': $('#city_state').val(), 'address': $('#address').val() }, function(data) { @@ -234,7 +231,7 @@ $(function() { } errors[0].focus(); } else { - $.get('<%= forms_path %>', { + $.get('<%= contents_path %>', { 'hydrant_id': activeHydrantId }, function(data) { activeInfoWindow.setContent(data); @@ -269,7 +266,7 @@ $(function() { $('#user_password').addClass('error', 500); $('#user_password').focus(); } else { - $.get('<%= forms_path %>', { + $.get('<%= contents_path %>', { 'hydrant_id': activeHydrantId }, function(data) { activeInfoWindow.setContent(data); @@ -314,7 +311,7 @@ $(function() { 'name': $('#hydrant_name').val() } }, function(data) { - $.get('<%= forms_path %>', { + $.get('<%= contents_path %>', { 'hydrant_id': activeHydrantId }, function(data) { activeInfoWindow.setContent(data); diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb index f1d246a..68a1ec3 100644 --- a/app/views/main/index.html.erb +++ b/app/views/main/index.html.erb @@ -3,12 +3,12 @@

Claim responsibility for shoveling out a fire hydrant after it snows.

- <%= 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" %> <%= select_tag "city_state", ''.html_safe, :tabindex => 10 %> <%= label_tag "address", "Address", :id => "address_label" %> <%= 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 %>
<%= image_tag "logos/cfa.png", :alt => "Code for America", :title => "Code for America" %> diff --git a/config/routes.rb b/config/routes.rb index d82e47e..43a4a0e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,6 +12,6 @@ AdoptAHydrant::Application.routes.draw do end get 'address' => 'addresses#index', :as => 'address' get 'sitemap' => 'sitemaps#index', :as => 'sitemap' - get 'forms' => 'forms#index', :as => 'forms' + get 'contents' => 'contents#index', :as => 'contents' root :to => 'main#index' end