<%= f.label "name", "Name", :id => "user_name_label" %>
<%= f.text_field "name", :tabindex => 3 %>
<%= f.label "organization", "Organization", :id => "user_organization_label" %>
@@ -17,14 +17,14 @@
<%= f.text_field "sms_number", :tabindex => 6 %>
<%= f.label "password_confirmation", "Choose a password", :id => "user_password_confirmation_label" %>
<%= f.password_field "password_confirmation", :tabindex => 7 %>
- <%= f.submit "Sign up", :tabindex => 8, :id => "sign_up_submit" %>
+ <%= f.submit "Sign up", :tabindex => 8, :id => "user_sign_up_submit" %>
By signing up, you agree to the <%= link_to "Terms of Service", "#", :tabindex => 9 %>.
+
<%= f.label "password", "Password", :id => "user_password_label" %>
<%= f.password_field "password", :tabindex => 0 %>
<%= f.label "remember_me", (f.check_box("remember_me", :checked => true, :tabindex => 0).html_safe + "Stay signed in"), :id => "user_remember_me_label" %>
- <%= f.submit "Sign in", :tabindex => 0, :id => "sign_in_submit" %>
+ <%= f.submit "Sign in", :tabindex => 0, :id => "user_sign_in_submit" %>
<%= link_to "Forgot your password?", "#", :id => "user_forgot_password_link", :tabindex => 0 %>
diff --git a/app/views/javascripts/main.js.erb b/app/views/javascripts/main.js.erb
index 1e655eb..f23821e 100644
--- a/app/views/javascripts/main.js.erb
+++ b/app/views/javascripts/main.js.erb
@@ -1,5 +1,4 @@
$(function() {
- var map;
var latlng = new google.maps.LatLng(42.358431, -71.059773);
var myOptions = {
mapTypeControl: false,
@@ -52,9 +51,9 @@ $(function() {
}
$('#location_form').submit(function() {
if($('#address').val() === '') {
- $('#address').focus();
$('#address_label').addClass('error', 500);
$('#address').addClass('error', 500);
+ $('#address').focus();
} else {
$.get('<%= address_path :format => "json" %>', {
'commit': $('#location_submit').val(),
@@ -64,9 +63,9 @@ $(function() {
'address': $('#address').val()
}, function(data) {
if(data.errors) {
- $('#address').focus();
$('#address_label').addClass('error', 500);
$('#address').addClass('error', 500);
+ $('#address').focus();
} else {
map.setZoom(18);
latlng = new google.maps.LatLng(data[0], data[1]);
@@ -80,9 +79,9 @@ $(function() {
}, function(data) {
// This should never happen, but just in case
if(data.errors) {
- $('#address').focus();
$('#address_label').addClass('error', 500);
$('#address').addClass('error', 500);
+ $('#address').focus();
} else {
$(data).each(function(index, hydrant) {
hydrant = hydrant.hydrant;
@@ -101,20 +100,20 @@ $(function() {
var self = $(this);
if('new' == self.val()) {
$('#user_forgot_password_fields').slideUp();
- $('#sign_in_fields').slideUp();
- $('#sign_up_fields').slideDown();
- $('#combo_form').data('state', 'sign_up');
+ $('#user_sign_in_fields').slideUp();
+ $('#user_sign_up_fields').slideDown();
+ $('#combo_form').data('state', 'user_sign_up');
} else if('existing' == self.val()) {
- $('#sign_up_fields').slideUp();
- $('#sign_in_fields').slideDown(function() {
- $('#combo_form').data('state', 'sign_in');
+ $('#user_sign_up_fields').slideUp();
+ $('#user_sign_in_fields').slideDown(function() {
+ $('#combo_form').data('state', 'user_sign_in');
$('#user_forgot_password_link').click(function() {
- $('#sign_in_fields').slideUp();
+ $('#user_sign_in_fields').slideUp();
$('#user_forgot_password_fields').slideDown(function() {
$('#user_remembered_password').click(function() {
$('#user_forgot_password_fields').slideUp();
- $('#sign_in_fields').slideDown();
- $('#combo_form').data('state', 'sign_in');
+ $('#user_sign_in_fields').slideDown();
+ $('#combo_form').data('state', 'user_sign_in');
});
});
$('#combo_form').data('state', 'user_forgot_password');
@@ -132,7 +131,7 @@ $(function() {
$('#user_email_label').removeClass('error');
$('#user_email').removeClass('error');
}
- if(!$(this).data('state') || $(this).data('state') === 'sign_up') {
+ if(!$(this).data('state') || $(this).data('state') === 'user_sign_up') {
if($('#user_name').val() === '') {
errors.push($('#user_name'));
$('#user_name_label').addClass('error', 500);
@@ -153,7 +152,7 @@ $(function() {
errors[0].focus();
} else {
$.post('<%= user_registration_path :format => "json" %>', {
- 'commit': $('#sign_up_submit').val(),
+ 'commit': $('#user_sign_up_submit').val(),
'utf8': '✓',
'authenticity_token': $('input[name="authenticity_token"]').val(),
'user': {
@@ -207,7 +206,7 @@ $(function() {
}
});
}
- } else if($(this).data('state') === 'sign_in') {
+ } else if($(this).data('state') === 'user_sign_in') {
if($('#user_password').val().length < 6 || $('#user_password').val().length > 20) {
errors.push($('#user_password'));
$('#user_password_label').addClass('error', 500);
@@ -220,7 +219,7 @@ $(function() {
errors[0].focus();
} else {
$.post('<%= user_session_path :format => "json" %>', {
- 'commit': $('#sign_in_submit').val(),
+ 'commit': $('#user_sign_in_submit').val(),
'utf8': '✓',
'authenticity_token': $('input[name="authenticity_token"]').val(),
'user': {
@@ -230,9 +229,9 @@ $(function() {
}
}, function(data) {
if(data.errors) {
- $('#user_password').focus();
$('#user_password_label').addClass('error', 500);
$('#user_password').addClass('error', 500);
+ $('#user_password').focus();
} else {
$.get('<%= forms_path %>', {
'hydrant_id': activeHydrantId
@@ -255,12 +254,12 @@ $(function() {
}
}, function(data) {
if(data.errors) {
- $('#user_email').focus();
$('#user_email_label').addClass('error', 500);
$('#user_email').addClass('error', 500);
+ $('#user_email').focus();
} else {
$('#user_forgot_password_fields').slideUp();
- $('#sign_in_fields').slideDown();
+ $('#user_sign_in_fields').slideDown();
}
});
}