Begin refactoring to allow Adopt-a-Whatever
This commit is contained in:
parent
98eff20127
commit
688b408308
|
@ -6,7 +6,7 @@ class AddressesController < ApplicationController
|
|||
unless @address.blank?
|
||||
respond_with @address
|
||||
else
|
||||
render(:json => {"errors" => {"address" => [t("errors.address")]}}, :status => 404)
|
||||
render(:json => {"errors" => {"address" => [t("errors.not_found", :thing => t("defaults.address"))]}}, :status => 404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class HydrantsController < ApplicationController
|
|||
unless @hydrants.blank?
|
||||
respond_with @hydrants
|
||||
else
|
||||
render(:json => {"errors" => {"address" => [t("errors.hydrants")]}}, :status => 404)
|
||||
render(:json => {"errors" => {"address" => [t("errors.not_found", :thing => t("defaults.thing"))]}}, :status => 404)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
= f.hidden_field "id"
|
||||
= f.hidden_field "user_id", :value => ""
|
||||
= f.hidden_field "name", :value => ""
|
||||
= f.submit t("buttons.abandon")
|
||||
= f.submit t("buttons.abandon", :thing => t("defaults.thing"))
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
= f.hidden_field "id"
|
||||
= f.hidden_field "user_id", :value => ""
|
||||
= f.hidden_field "name", :value => ""
|
||||
= f.submit t("buttons.steal")
|
||||
= f.submit t("buttons.steal", :thing => t("buttons.thing"))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
= form_for :hydrant, :url => hydrants_path, :method => :put, :html => {:id => "adoption_form"} do |f|
|
||||
%h2
|
||||
= t("titles.adopt")
|
||||
= t("titles.adopt", :thing => t("defaults.thing").titleize)
|
||||
= f.hidden_field "id"
|
||||
= f.hidden_field "user_id", :value => current_user.id
|
||||
= f.label "name", t("labels.name_hydrant"), :id => "hydrant_name_label"
|
||||
= f.label "name", t("labels.name_thing", :thing => t("defaults.thing")), :id => "hydrant_name_label"
|
||||
= f.text_field "name", :tabindex => 1
|
||||
= f.submit t("buttons.adopt"), :tabindex => 2
|
||||
= render :partial => 'users/edit_profile'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
%html
|
||||
%head
|
||||
%title
|
||||
= t("titles.main")
|
||||
= t("titles.main", :thing => t("defaults.thing").titleize)
|
||||
= stylesheet_link_tag "application"
|
||||
= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false"
|
||||
= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#sidebar
|
||||
%h1
|
||||
= t("titles.main")
|
||||
= t("titles.main", :thing => t("defaults.thing").titleize)
|
||||
%p#tagline
|
||||
= t("defaults.tagline")
|
||||
= form_for :address, :html => {:id => "address_form"} do |f|
|
||||
|
@ -9,12 +9,12 @@
|
|||
= label_tag "address", t("labels.address"), :id => "address_label"
|
||||
= text_field_tag "address", params[:address], :tabindex => 11
|
||||
= hidden_field_tag "limit", params[:limit] || 20
|
||||
= submit_tag t("buttons.find"), :tabindex => 12
|
||||
= submit_tag t("buttons.find", :thing => t("defaults.thing").pluralize), :tabindex => 12
|
||||
#logos
|
||||
= image_tag "logos/cfa.png", :alt => t("sponsors.cfa"), :title => t("sponsors.cfa")
|
||||
= image_tag "logos/boston.png", :alt => t("sponsors.city"), :title => t("sponsors.city")
|
||||
#feedback
|
||||
%a{:href => "mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main")} #{t("links.feedback")}"}
|
||||
%a{:href => "mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main", :thing => t("defaults.thing").titleize)} #{t("links.feedback")}"}
|
||||
= t("links.feedback")
|
||||
= image_tag "hydrant-in-snow.jpg", :id => "hydrant-in-snow"
|
||||
#map_canvas
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
= form_for :user, :html => {:id => "combo_form"} do |f|
|
||||
%h2
|
||||
= t("titles.adopt")
|
||||
= t("titles.adopt", :thing => t("defaults.thing").titleize)
|
||||
#common_fields
|
||||
= f.label "email", t("labels.email"), :id => "user_email_label"
|
||||
%em
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%h2
|
||||
= t("titles.adopted", :hydrant_name => @hydrant.name ? @hydrant.name.titleize : t("defaults.hydrant_name"))
|
||||
= t("titles.adopted", :thing_name => @hydrant.name ? @hydrant.name.titleize : t("defaults.this_thing", :thing => t("defaults.thing")))
|
||||
%br
|
||||
= t("titles.byline", :name => @hydrant.user.name)
|
||||
%br
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%h2
|
||||
= t("titles.thank_you")
|
||||
= t("titles.thank_you", :thing => t("defaults.thing"))
|
||||
= render :partial => 'hydrants/abandon'
|
||||
= render :partial => 'users/edit_profile'
|
||||
= render :partial => 'sessions/sign_out'
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
en:
|
||||
buttons:
|
||||
abandon: "Abandon this hydrant"
|
||||
abandon: "Abandon this %{thing}"
|
||||
adopt: "Adopt!"
|
||||
back: "Back"
|
||||
change_password: "Change my password"
|
||||
edit_profile: "Edit profile"
|
||||
email_password: "Email me my password"
|
||||
find: "Find fire hydrants"
|
||||
find: "Find %{thing}"
|
||||
send_reminder: "Send reminder to shovel"
|
||||
sign_in: "Sign in"
|
||||
sign_out: "Sign out"
|
||||
sign_up: "Sign up"
|
||||
steal: "Steal this hydrant"
|
||||
steal: "Steal this %{thing}"
|
||||
update: "Update"
|
||||
captions:
|
||||
current_password: "(we need your current password to confirm your changes)"
|
||||
|
@ -21,20 +21,21 @@ en:
|
|||
private: "(private)"
|
||||
public: "(may be visible to other users)"
|
||||
defaults:
|
||||
address: "address"
|
||||
city: "Boston, MA"
|
||||
hydrant_name: "This hydrant"
|
||||
thing: "hydrant"
|
||||
this_thing: "This %{thing}"
|
||||
tagline: "Claim responsibility for shoveling out a fire hydrant after it snows."
|
||||
tos: "By signing up, you agree to the %{tos}."
|
||||
errors:
|
||||
address: "Could not find address."
|
||||
password: "You need to sign in or sign up before continuing."
|
||||
hydrants: "Could not find hydrants."
|
||||
not_found: "Could not find %{thing}."
|
||||
labels:
|
||||
address: "Address, Neighborhood"
|
||||
city_state: "City"
|
||||
email: "Email address"
|
||||
name: "Name"
|
||||
name_hydrant: "Give this hydrant a name"
|
||||
name_thing: "Give this %{thing} a name"
|
||||
organization: "Organization"
|
||||
password: "Password"
|
||||
password_choose: "Choose a password"
|
||||
|
@ -50,13 +51,13 @@ en:
|
|||
forgot_password: "Forgot your password?"
|
||||
remembered_password: "Never mind. I remembered my password."
|
||||
titles:
|
||||
adopt: "Adopt this Hydrant"
|
||||
adopted: "%{hydrant_name} has been adopted"
|
||||
adopt: "Adopt this %{thing}"
|
||||
adopted: "%{thing_name} has been adopted"
|
||||
byline: "by %{name}"
|
||||
edit_profile: "Edit your Profile"
|
||||
main: "Adopt a Hydrant"
|
||||
main: "Adopt a %{thing}"
|
||||
ofline: "of %{organization}"
|
||||
thank_you: "Thank you for adopting this hydrant!"
|
||||
thank_you: "Thank you for adopting this %{thing}!"
|
||||
tos: "Terms of Service"
|
||||
sponsors:
|
||||
cfa: "Code for America"
|
||||
|
|
|
@ -19,7 +19,7 @@ class MainControllerTest < ActionController::TestCase
|
|||
assert_select 'input#address', true
|
||||
assert_select 'input[name="commit"]' do
|
||||
assert_select '[type=?]', 'submit'
|
||||
assert_select '[value=?]', 'Find fire hydrants'
|
||||
assert_select '[value=?]', 'Find hydrants'
|
||||
end
|
||||
assert_select 'div#map_canvas', true
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue