Finish hydrant refactoring

This commit is contained in:
Erik Michaels-Ober 2011-09-15 22:00:04 -07:00
parent 9ea3d90227
commit e1d60ebded
8 changed files with 26 additions and 17 deletions

View File

@ -275,7 +275,7 @@ $(function() {
data: { data: {
'thing_id': activeThingId, 'thing_id': activeThingId,
'flash': { 'flash': {
'notice': "Thanks for signing up!" 'notice': "<%= I18n.t("notices.signed_up") %>"
} }
}, },
success: function(data) { success: function(data) {
@ -330,7 +330,7 @@ $(function() {
data: { data: {
'thing_id': activeThingId, 'thing_id': activeThingId,
'flash': { 'flash': {
'notice': "Signed in!" 'notice': "<%= I18n.t("notices.signed_in") %>"
} }
}, },
success: function(data) { success: function(data) {
@ -377,7 +377,7 @@ $(function() {
'email': $('#user_email').val() 'email': $('#user_email').val()
}, },
'flash': { 'flash': {
'notice': "Password reset instructions sent! Check your email." 'notice': "<%= I18n.t("notices.password_reset") %>"
} }
}, },
success: function(data) { success: function(data) {
@ -424,7 +424,7 @@ $(function() {
data: { data: {
'thing_id': activeThingId, 'thing_id': activeThingId,
'flash': { 'flash': {
'notice': "You just adopted " + $('#thing_name').val() + "!" 'notice': "<%= I18n.t("notices.adopted", :thing => I18n.t("defaults.thing")) %>"
} }
}, },
success: function(data) { success: function(data) {
@ -444,7 +444,7 @@ $(function() {
return false; return false;
}); });
$('#abandon_form').live('submit', function() { $('#abandon_form').live('submit', function() {
var answer = window.confirm("Are you sure you want to abandon this hydrant?") var answer = window.confirm("Are you sure you want to abandon this <%= I18n.t("defaults.thing") %>?")
if(answer) { if(answer) {
var submitButton = $("#abandon_form input[type='submit']"); var submitButton = $("#abandon_form input[type='submit']");
$(submitButton).attr("disabled", true); $(submitButton).attr("disabled", true);
@ -478,7 +478,7 @@ $(function() {
data: { data: {
'thing_id': activeThingId, 'thing_id': activeThingId,
'flash': { 'flash': {
'notice': "Hydrant abandoned!" 'notice': "<%= I18n.t("notices.abandoned", :thing => I18n.t("defaults.thing").capitalize) %>"
} }
}, },
success: function(data) { success: function(data) {
@ -498,7 +498,7 @@ $(function() {
return false; return false;
}); });
$('#steal_form').live('submit', function() { $('#steal_form').live('submit', function() {
var answer = window.confirm("Are you sure you want to steal this hydrant?") var answer = window.confirm("Are you sure you want to steal this <%= I18n.t("defaults.thing") %>?")
if(answer) { if(answer) {
var submitButton = $("#steal_form input[type='submit']"); var submitButton = $("#steal_form input[type='submit']");
$(submitButton).attr("disabled", true); $(submitButton).attr("disabled", true);
@ -532,7 +532,7 @@ $(function() {
data: { data: {
'thing_id': activeThingId, 'thing_id': activeThingId,
'flash': { 'flash': {
'notice': "Hydrant stolen!" 'notice': "<%= I18n.t("notices.stolen", :thing => I18n.t("defaults.thing").capitalize) %>"
} }
}, },
success: function(data) { success: function(data) {
@ -718,7 +718,7 @@ $(function() {
data: { data: {
'thing_id': activeThingId, 'thing_id': activeThingId,
'flash': { 'flash': {
'notice': "Signed out." 'notice': "<%= I18n.t("notices.signed_out") %>"
} }
}, },
success: function(data) { success: function(data) {
@ -814,7 +814,7 @@ $(function() {
data: { data: {
'thing_id': activeThingId, 'thing_id': activeThingId,
'flash': { 'flash': {
'notice': "Reminder sent!" 'notice': "<%= I18n.t("notices.reminder_sent") %>"
} }
}, },
success: function(data) { success: function(data) {

View File

@ -14,7 +14,7 @@
= image_tag "logos/cfa.png", :alt => t("sponsors.cfa"), :title => t("sponsors.cfa") = 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") = image_tag "logos/boston.png", :alt => t("sponsors.city"), :title => t("sponsors.city")
#feedback #feedback
%a{:href => "mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main", :thing => t("defaults.thing").titleize)} #{t("links.feedback")}"} %a{:href => "mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main", :thing => t("defaults.thing").titleize)} #{t("links.feedback").titleize}"}
= t("links.feedback") = t("links.feedback")
= image_tag "hydrant-in-snow.jpg", :id => "hydrant-in-snow" = image_tag "hydrant-in-snow.jpg", :id => "hydrant-in-snow"
#map_canvas #map_canvas

View File

@ -1,4 +1,4 @@
= form_for :hydrant, :url => things_path, :method => :put, :html => {:id => "abandon_form"} do |f| = form_for :thing, :url => things_path, :method => :put, :html => {:id => "abandon_form"} do |f|
= f.hidden_field "id" = f.hidden_field "id"
= f.hidden_field "user_id", :value => "" = f.hidden_field "user_id", :value => ""
= f.hidden_field "name", :value => "" = f.hidden_field "name", :value => ""

View File

@ -1,3 +1,3 @@
= form_for :hydrants, :url => info_window_path, :html => {:id => "back_form", :method => "get"} do |f| = form_for :things, :url => info_window_path, :html => {:id => "back_form", :method => "get"} do |f|
= f.hidden_field "id" = f.hidden_field "id"
= f.submit t("buttons.back") = f.submit t("buttons.back")

View File

@ -1,4 +1,4 @@
= form_for :hydrant, :url => things_path, :method => :put, :html => {:id => "steal_form"} do |f| = form_for :thing, :url => things_path, :method => :put, :html => {:id => "steal_form"} do |f|
= f.hidden_field "id" = f.hidden_field "id"
= f.hidden_field "user_id", :value => "" = f.hidden_field "user_id", :value => ""
= f.hidden_field "name", :value => "" = f.hidden_field "name", :value => ""

View File

@ -1,9 +1,9 @@
= form_for :hydrant, :url => things_path, :method => :put, :html => {:id => "adoption_form"} do |f| = form_for :thing, :url => things_path, :method => :put, :html => {:id => "adoption_form"} do |f|
%h2 %h2
= t("titles.adopt", :thing => t("defaults.thing").titleize) = t("titles.adopt", :thing => t("defaults.thing").titleize)
= f.hidden_field "id" = f.hidden_field "id"
= f.hidden_field "user_id", :value => current_user.id = f.hidden_field "user_id", :value => current_user.id
= f.label "name", t("labels.name_thing", :thing => t("defaults.thing")), :id => "hydrant_name_label" = f.label "name", t("labels.name_thing", :thing => t("defaults.thing")), :id => "thing_name_label"
= f.text_field "name", :tabindex => 1 = f.text_field "name", :tabindex => 1
= f.submit t("buttons.adopt"), :tabindex => 2 = f.submit t("buttons.adopt"), :tabindex => 2
= render :partial => 'users/edit_profile' = render :partial => 'users/edit_profile'

View File

@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
AdoptAThing::Application.config.session_store :cookie_store, :key => '_adopt-a-hydrant_session' AdoptAThing::Application.config.session_store :cookie_store, :key => '_adopt-a-thing_session'
# Use the database for sessions instead of the cookie-based default, # Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information # which shouldn't be used to store highly confidential information

View File

@ -50,6 +50,15 @@ en:
feedback: "Feedback" feedback: "Feedback"
forgot_password: "Forgot your password?" forgot_password: "Forgot your password?"
remembered_password: "Never mind. I remembered my password." remembered_password: "Never mind. I remembered my password."
notices:
abandoned: "%{thing} abandoned!"
adopted: "You just adopted a %{thing}!"
password_reset: "Password reset instructions sent! Check your email."
reminder_sent: "Reminder sent!"
signed_in: "Signed in!"
signed_out: "Signed out."
signed_up: "Thanks for signing up!"
stolen: "%{thing} stolen!"
titles: titles:
adopt: "Adopt this %{thing}" adopt: "Adopt this %{thing}"
adopted: "%{thing_name} has been adopted" adopted: "%{thing_name} has been adopted"