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