Skip to content
This repository
Browse code

Begin refactoring to allow Adopt-a-Whatever

  • Loading branch information...
commit 688b40830843e15d167dbbeccb65f346af706376 1 parent 98eff20
Erik Michaels-Ober sferik authored
2  app/controllers/addresses_controller.rb
@@ -6,7 +6,7 @@ def show
6 6 unless @address.blank?
7 7 respond_with @address
8 8 else
9   - render(:json => {"errors" => {"address" => [t("errors.address")]}}, :status => 404)
  9 + render(:json => {"errors" => {"address" => [t("errors.not_found", :thing => t("defaults.address"))]}}, :status => 404)
10 10 end
11 11 end
12 12 end
2  app/controllers/hydrants_controller.rb
@@ -6,7 +6,7 @@ def show
6 6 unless @hydrants.blank?
7 7 respond_with @hydrants
8 8 else
9   - render(:json => {"errors" => {"address" => [t("errors.hydrants")]}}, :status => 404)
  9 + render(:json => {"errors" => {"address" => [t("errors.not_found", :thing => t("defaults.thing"))]}}, :status => 404)
10 10 end
11 11 end
12 12
2  app/views/hydrants/_abandon.html.haml
@@ -2,4 +2,4 @@
2 2 = f.hidden_field "id"
3 3 = f.hidden_field "user_id", :value => ""
4 4 = f.hidden_field "name", :value => ""
5   - = f.submit t("buttons.abandon")
  5 + = f.submit t("buttons.abandon", :thing => t("defaults.thing"))
2  app/views/hydrants/_steal.html.haml
@@ -2,4 +2,4 @@
2 2 = f.hidden_field "id"
3 3 = f.hidden_field "user_id", :value => ""
4 4 = f.hidden_field "name", :value => ""
5   - = f.submit t("buttons.steal")
  5 + = f.submit t("buttons.steal", :thing => t("buttons.thing"))
4 app/views/hydrants/adopt.html.haml
... ... @@ -1,9 +1,9 @@
1 1 = form_for :hydrant, :url => hydrants_path, :method => :put, :html => {:id => "adoption_form"} do |f|
2 2 %h2
3   - = t("titles.adopt")
  3 + = t("titles.adopt", :thing => t("defaults.thing").titleize)
4 4 = f.hidden_field "id"
5 5 = f.hidden_field "user_id", :value => current_user.id
6   - = f.label "name", t("labels.name_hydrant"), :id => "hydrant_name_label"
  6 + = f.label "name", t("labels.name_thing", :thing => t("defaults.thing")), :id => "hydrant_name_label"
7 7 = f.text_field "name", :tabindex => 1
8 8 = f.submit t("buttons.adopt"), :tabindex => 2
9 9 = render :partial => 'users/edit_profile'
2  app/views/layouts/application.html.haml
@@ -2,7 +2,7 @@
2 2 %html
3 3 %head
4 4 %title
5   - = t("titles.main")
  5 + = t("titles.main", :thing => t("defaults.thing").titleize)
6 6 = stylesheet_link_tag "application"
7 7 = javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false"
8 8 = javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
6 app/views/main/index.html.haml
... ... @@ -1,6 +1,6 @@
1 1 #sidebar
2 2 %h1
3   - = t("titles.main")
  3 + = t("titles.main", :thing => t("defaults.thing").titleize)
4 4 %p#tagline
5 5 = t("defaults.tagline")
6 6 = form_for :address, :html => {:id => "address_form"} do |f|
@@ -9,12 +9,12 @@
9 9 = label_tag "address", t("labels.address"), :id => "address_label"
10 10 = text_field_tag "address", params[:address], :tabindex => 11
11 11 = hidden_field_tag "limit", params[:limit] || 20
12   - = submit_tag t("buttons.find"), :tabindex => 12
  12 + = submit_tag t("buttons.find", :thing => t("defaults.thing").pluralize), :tabindex => 12
13 13 #logos
14 14 = image_tag "logos/cfa.png", :alt => t("sponsors.cfa"), :title => t("sponsors.cfa")
15 15 = image_tag "logos/boston.png", :alt => t("sponsors.city"), :title => t("sponsors.city")
16 16 #feedback
17   - %a{:href => "mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main")} #{t("links.feedback")}"}
  17 + %a{:href => "mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main", :thing => t("defaults.thing").titleize)} #{t("links.feedback")}"}
18 18 = t("links.feedback")
19 19 = image_tag "hydrant-in-snow.jpg", :id => "hydrant-in-snow"
20 20 #map_canvas
2  app/views/sessions/new.html.haml
... ... @@ -1,6 +1,6 @@
1 1 = form_for :user, :html => {:id => "combo_form"} do |f|
2 2 %h2
3   - = t("titles.adopt")
  3 + = t("titles.adopt", :thing => t("defaults.thing").titleize)
4 4 #common_fields
5 5 = f.label "email", t("labels.email"), :id => "user_email_label"
6 6 %em
2  app/views/users/profile.html.haml
... ... @@ -1,5 +1,5 @@
1 1 %h2
2   - = t("titles.adopted", :hydrant_name => @hydrant.name ? @hydrant.name.titleize : t("defaults.hydrant_name"))
  2 + = t("titles.adopted", :thing_name => @hydrant.name ? @hydrant.name.titleize : t("defaults.this_thing", :thing => t("defaults.thing")))
3 3 %br
4 4 = t("titles.byline", :name => @hydrant.user.name)
5 5 %br
2  app/views/users/thank_you.html.haml
... ... @@ -1,5 +1,5 @@
1 1 %h2
2   - = t("titles.thank_you")
  2 + = t("titles.thank_you", :thing => t("defaults.thing"))
3 3 = render :partial => 'hydrants/abandon'
4 4 = render :partial => 'users/edit_profile'
5 5 = render :partial => 'sessions/sign_out'
23 config/locales/en.yml
@@ -2,18 +2,18 @@
2 2
3 3 en:
4 4 buttons:
5   - abandon: "Abandon this hydrant"
  5 + abandon: "Abandon this %{thing}"
6 6 adopt: "Adopt!"
7 7 back: "Back"
8 8 change_password: "Change my password"
9 9 edit_profile: "Edit profile"
10 10 email_password: "Email me my password"
11   - find: "Find fire hydrants"
  11 + find: "Find %{thing}"
12 12 send_reminder: "Send reminder to shovel"
13 13 sign_in: "Sign in"
14 14 sign_out: "Sign out"
15 15 sign_up: "Sign up"
16   - steal: "Steal this hydrant"
  16 + steal: "Steal this %{thing}"
17 17 update: "Update"
18 18 captions:
19 19 current_password: "(we need your current password to confirm your changes)"
@@ -21,20 +21,21 @@ en:
21 21 private: "(private)"
22 22 public: "(may be visible to other users)"
23 23 defaults:
  24 + address: "address"
24 25 city: "Boston, MA"
25   - hydrant_name: "This hydrant"
  26 + thing: "hydrant"
  27 + this_thing: "This %{thing}"
26 28 tagline: "Claim responsibility for shoveling out a fire hydrant after it snows."
27 29 tos: "By signing up, you agree to the %{tos}."
28 30 errors:
29   - address: "Could not find address."
30 31 password: "You need to sign in or sign up before continuing."
31   - hydrants: "Could not find hydrants."
  32 + not_found: "Could not find %{thing}."
32 33 labels:
33 34 address: "Address, Neighborhood"
34 35 city_state: "City"
35 36 email: "Email address"
36 37 name: "Name"
37   - name_hydrant: "Give this hydrant a name"
  38 + name_thing: "Give this %{thing} a name"
38 39 organization: "Organization"
39 40 password: "Password"
40 41 password_choose: "Choose a password"
@@ -50,13 +51,13 @@ en:
50 51 forgot_password: "Forgot your password?"
51 52 remembered_password: "Never mind. I remembered my password."
52 53 titles:
53   - adopt: "Adopt this Hydrant"
54   - adopted: "%{hydrant_name} has been adopted"
  54 + adopt: "Adopt this %{thing}"
  55 + adopted: "%{thing_name} has been adopted"
55 56 byline: "by %{name}"
56 57 edit_profile: "Edit your Profile"
57   - main: "Adopt a Hydrant"
  58 + main: "Adopt a %{thing}"
58 59 ofline: "of %{organization}"
59   - thank_you: "Thank you for adopting this hydrant!"
  60 + thank_you: "Thank you for adopting this %{thing}!"
60 61 tos: "Terms of Service"
61 62 sponsors:
62 63 cfa: "Code for America"
2  test/functional/main_controller_test.rb
@@ -19,7 +19,7 @@ class MainControllerTest < ActionController::TestCase
19 19 assert_select 'input#address', true
20 20 assert_select 'input[name="commit"]' do
21 21 assert_select '[type=?]', 'submit'
22   - assert_select '[value=?]', 'Find fire hydrants'
  22 + assert_select '[value=?]', 'Find hydrants'
23 23 end
24 24 assert_select 'div#map_canvas', true
25 25 end

0 comments on commit 688b408

Please sign in to comment.
Something went wrong with that request. Please try again.