Combine city and state pulldown menus
This commit is contained in:
parent
013eed231c
commit
5f3a2578c4
|
@ -4,10 +4,10 @@ class WelcomeController < ApplicationController
|
|||
# Default coordinates: Boston center
|
||||
@lat, @lng = 42.358431, -71.059773
|
||||
@hydrants = []
|
||||
address, city, state = params[:address], params[:city], params[:state]
|
||||
if address && city && state
|
||||
address, city_state = params[:address], params[:city_state]
|
||||
if address && city_state
|
||||
@zoom = 18
|
||||
@lat, @lng = Address.find_lat_lng("#{address}, #{city}, #{state}")
|
||||
@lat, @lng = Address.find_lat_lng("#{address}, #{city_state}")
|
||||
@hydrants = Hydrant.find_closest(@lat, @lng)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,14 +3,12 @@
|
|||
<p id="tagline">
|
||||
Claim responsibility for shoveling out a fire hydrant after it snows.
|
||||
</p>
|
||||
<%= form_tag do %>
|
||||
<%= label_tag "state" %>
|
||||
<%= select_tag "state", '<option value="MA" selected="selected">Massachusetts</option>'.html_safe, :tabindex => 10 %>
|
||||
<%= label_tag "city" %>
|
||||
<%= select_tag "city", '<option value="Boston" selected="selected">Boston</option>'.html_safe, :tabindex => 11 %>
|
||||
<%= form_tag "/", :method => :get, :class => "location_form" do %>
|
||||
<%= label_tag "city_state", "City" %>
|
||||
<%= select_tag "city_state", '<option value="Boston, MA" selected="selected">Boston, MA</option>'.html_safe, :tabindex => 10 %>
|
||||
<%= label_tag "address" %>
|
||||
<%= text_field_tag "address", params[:address], :tabindex => 12 %>
|
||||
<%= submit_tag "Find Fire Hydrants", :tabindex => 13 %>
|
||||
<%= text_field_tag "address", params[:address], :tabindex => 11 %>
|
||||
<%= submit_tag "Find Fire Hydrants", :tabindex => 12 %>
|
||||
<% end %>
|
||||
<div id="logos">
|
||||
<%= image_tag "logos/boston.png", :alt => "City of Boston", :title => "City of Boston" %>
|
||||
|
|
|
@ -59,7 +59,6 @@ label, input {
|
|||
input, select, option, button, input[type="submit"] {
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
|
||||
font-size: 1.0em;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue