ripple-core
Version:
Ripple is an interactive audience response system that allows presenters to survey audience members in real time communication through their mobile devices.
46 lines (37 loc) • 1.63 kB
JavaScript
$(document).ready(function(){
var av = new AccountValidator();
$('#account-form').ajaxForm({
beforeSubmit : function(formData, jqForm, options){
return av.validateForm();
},
success : function(responseText, status, xhr, $form){
if (status == 'success') {
$('.modal-alert').modal('show');
setTimeout(function(){window.location.href = '/admin';}, 3000);
}
},
error : function(e){
if (e.responseText == 'email-taken'){
av.showInvalidEmail();
} else if (e.responseText == 'username-taken'){
av.showInvalidUserName();
}
}
});
$('#name-tf').focus();
// customize the account signup form //
$('#account-form h1').text('Create an Account');
$('#account-form #sub1').text('Please tell us a little about yourself');
$('#account-form #sub2').text('Choose your Username & Password');
$('#account-form-btn1').html('Cancel');
$('#account-form-btn2').html('Submit');
$('#account-form-btn2').addClass('btn-primary');
// setup the alert that displays when an account is successfully created //
$('.modal-alert').modal({ show : false, keyboard : false, backdrop : 'static' });
$('.modal-alert .modal-header h3').text('Success!');
$('.modal-alert .modal-body p').html('Your account has been created.</br>Click OK to access the admin dashboard.');
// redirect to homepage when cancel button is clicked //
$('#account-form-btn1').click(function(){ window.location.href = '/';});
// redirect to homepage on new account creation, add short delay so user can read alert window //
$('.modal-alert #alertOK').click(function(){ window.location.href = '/admin';});
})