Commit b5ec11af by Brian Talbot

edx.org - adding in more UI status when processing login/register forms

parent 7a0ddb24
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<%block name="js_extra"> <%block name="js_extra">
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
var view_name = 'view-login'; var view_name = 'view-login';
// adding js class for styling with accessibility in mind // adding js class for styling with accessibility in mind
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
(function() { (function() {
$(document).delegate('#login-form', 'ajax:success', function(data, json, xhr) { $(document).delegate('#login-form', 'ajax:success', function(data, json, xhr) {
if(json.success) { if(json.success) {
$('.message.submission-error').removeClass('is-shown'); $('.message.submission-error').removeClass('is-shown');
toggleSubmitButton(); toggleSubmitButton();
var u=decodeURI(window.location.search); var u=decodeURI(window.location.search);
next=u.split("next=")[1]; next=u.split("next=")[1];
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
location.href="${reverse('dashboard')}"; location.href="${reverse('dashboard')}";
} }
} else { } else {
$('.message.submission-error').addClass('is-shown'); $('.message.submission-error').addClass('is-shown');
toggleSubmitButton(); toggleSubmitButton();
$('.message.submission-error .message-copy').html(json.value); $('.message.submission-error .message-copy').html(json.value);
} }
...@@ -51,13 +51,14 @@ ...@@ -51,13 +51,14 @@
function toggleSubmitButton(e) { function toggleSubmitButton(e) {
var $msgError = $('form .status.submission-error'); var $msgError = $('form .status.submission-error');
var $submitButton = $('form .form-actions #submit'); var $submitButton = $('form .form-actions #submit');
var $submitButtonCopy = $submitButton.html();
if(!$msgError.hasClass('is-shown')) { if(!$msgError.hasClass('is-shown')) {
$submitButton.prop('disabled', true); $submitButton.prop('disabled', true).html('Processing your account information &hellip;');
} }
else { else {
$submitButton.prop('disabled', false); $submitButton.prop('disabled', false).html($submitButtonCopy);
} }
} }
</script> </script>
...@@ -76,7 +77,7 @@ ...@@ -76,7 +77,7 @@
</header> </header>
<form role="form" id="login-form" method="post" data-remote="true" action="/login_ajax"> <form role="form" id="login-form" method="post" data-remote="true" action="/login_ajax">
<!-- status messages --> <!-- status messages -->
<div role="alert" class="status message"> <div role="alert" class="status message">
<h3 class="message-title">We're Sorry, edX accounts are unavailable currently</h3> <h3 class="message-title">We're Sorry, edX accounts are unavailable currently</h3>
...@@ -91,7 +92,7 @@ ...@@ -91,7 +92,7 @@
</div> </div>
<p class="instructions sr"> <p class="instructions sr">
Please provide the following information to log into your edX account. Required fields are noted by <strong class="indicator">bold text and an asterisk (*)</strong>. Please provide the following information to log into your edX account. Required fields are noted by <strong class="indicator">bold text and an asterisk (*)</strong>.
</p> </p>
<fieldset class="group group-form group-form-requiredinformation"> <fieldset class="group group-form group-form-requiredinformation">
...@@ -100,7 +101,7 @@ ...@@ -100,7 +101,7 @@
<ol class="list-input"> <ol class="list-input">
<li class="field required text" id="field-email"> <li class="field required text" id="field-email">
<label for="email">E-mail</label> <label for="email">E-mail</label>
<input class="" id="email" type="email" name="email" value="" placeholder="example: username@domain.com" /> <input class="" id="email" type="email" name="email" value="" placeholder="example: username@domain.com" />
</li> </li>
<li class="field required password" id="field-password"> <li class="field required password" id="field-password">
<label for="password">Password</label> <label for="password">Password</label>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
(function() { (function() {
$(document).delegate('#register-form', 'ajax:success', function(data, json, xhr) { $(document).delegate('#register-form', 'ajax:success', function(data, json, xhr) {
if(json.success) { if(json.success) {
$('.message.submission-error').removeClass('is-shown'); $('.message.submission-error').removeClass('is-shown');
toggleSubmitButton(); toggleSubmitButton();
location.href="${reverse('dashboard')}"; location.href="${reverse('dashboard')}";
} else { } else {
...@@ -52,13 +52,14 @@ ...@@ -52,13 +52,14 @@
function toggleSubmitButton(e) { function toggleSubmitButton(e) {
var $msgError = $('form .status.submission-error'); var $msgError = $('form .status.submission-error');
var $submitButton = $('form .form-actions #submit').prop('disabled', true); var $submitButton = $('form .form-actions #submit').prop('disabled', true);
var $submitButtonCopy = $submitButton.html();
if(!$msgError.hasClass('is-shown')) { if(!$msgError.hasClass('is-shown')) {
$submitButton.prop('disabled', true); $submitButton.prop('disabled', true).html('Processing your registration &hellip;');
} }
else { else {
$submitButton.prop('disabled', false); $submitButton.prop('disabled', false).html($submitButtonCopy);
} }
} }
</script> </script>
...@@ -77,7 +78,7 @@ ...@@ -77,7 +78,7 @@
</header> </header>
<form role="form" id="register-form" method="post" data-remote="true" action="/create_account"> <form role="form" id="register-form" method="post" data-remote="true" action="/create_account">
<!-- status messages --> <!-- status messages -->
<div role="alert" class="status message"> <div role="alert" class="status message">
<h3 class="message-title">We're sorry, edX enrollment is not available in your region</h3> <h3 class="message-title">We're sorry, edX enrollment is not available in your region</h3>
...@@ -91,7 +92,7 @@ ...@@ -91,7 +92,7 @@
<p class="instructions"> <p class="instructions">
Please complete the following fields to register for an edX account. <br /> Please complete the following fields to register for an edX account. <br />
Required fields are noted by <strong class="indicator">bold text and an asterisk (*)</strong>. Required fields are noted by <strong class="indicator">bold text and an asterisk (*)</strong>.
</p> </p>
<fieldset class="group group-form group-form-requiredinformation"> <fieldset class="group group-form group-form-requiredinformation">
...@@ -102,7 +103,7 @@ ...@@ -102,7 +103,7 @@
<ol class="list-input"> <ol class="list-input">
<li class="field required text" id="field-email"> <li class="field required text" id="field-email">
<label for="email">E-mail</label> <label for="email">E-mail</label>
<input class="" id="email" type="email" name="email" value="" placeholder="example: username@domain.com" /> <input class="" id="email" type="email" name="email" value="" placeholder="example: username@domain.com" />
</li> </li>
<li class="field required password" id="field-password"> <li class="field required password" id="field-password">
<label for="password">Password</label> <label for="password">Password</label>
...@@ -236,4 +237,4 @@ ...@@ -236,4 +237,4 @@
<p>Need help in registering with edX? <a href="#">View our FAQs for answers to commonly asked questions</a>. Once registered, most questions can be answered in the course specific discussion forums or through the FAQs.</p> <p>Need help in registering with edX? <a href="#">View our FAQs for answers to commonly asked questions</a>. Once registered, most questions can be answered in the course specific discussion forums or through the FAQs.</p>
</div> </div>
</aside> </aside>
</section> </section>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment