Merge pull request #1841 from MITx/fix/btalbot/loginregister-actions
Fix/btalbot/loginregister actions
This commit is contained in:
@@ -391,7 +391,7 @@
|
||||
button[type="submit"] {
|
||||
@extend .button-primary;
|
||||
|
||||
&:disabled {
|
||||
&:disabled, &.is-disabled {
|
||||
opacity: 0.3;
|
||||
cursor: default !important;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<%block name="js_extra">
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
|
||||
var view_name = 'view-login';
|
||||
|
||||
// adding js class for styling with accessibility in mind
|
||||
@@ -30,8 +30,10 @@
|
||||
|
||||
(function() {
|
||||
$(document).delegate('#login-form', 'ajax:success', function(data, json, xhr) {
|
||||
$(this).find('.form-actions #submit').addClass('is-disabled');
|
||||
|
||||
if(json.success) {
|
||||
$('.message.submission-error').removeClass('is-shown');
|
||||
$('.message.submission-error').removeClass('is-shown');
|
||||
toggleSubmitButton();
|
||||
var u=decodeURI(window.location.search);
|
||||
next=u.split("next=")[1];
|
||||
@@ -41,7 +43,7 @@
|
||||
location.href="${reverse('dashboard')}";
|
||||
}
|
||||
} else {
|
||||
$('.message.submission-error').addClass('is-shown');
|
||||
$('.message.submission-error').addClass('is-shown');
|
||||
toggleSubmitButton();
|
||||
$('.message.submission-error .message-copy').html(json.value);
|
||||
}
|
||||
@@ -51,13 +53,14 @@
|
||||
function toggleSubmitButton(e) {
|
||||
var $msgError = $('form .status.submission-error');
|
||||
var $submitButton = $('form .form-actions #submit');
|
||||
var $submitButtonCopy = $submitButton.html();
|
||||
|
||||
if(!$msgError.hasClass('is-shown')) {
|
||||
$submitButton.prop('disabled', true);
|
||||
$submitButton.prop('disabled', true).html('Processing your account information …');
|
||||
}
|
||||
|
||||
else {
|
||||
$submitButton.prop('disabled', false);
|
||||
$submitButton.prop('disabled', false).html($submitButtonCopy);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -76,7 +79,7 @@
|
||||
</header>
|
||||
|
||||
<form role="form" id="login-form" method="post" data-remote="true" action="/login_ajax">
|
||||
|
||||
|
||||
<!-- status messages -->
|
||||
<div role="alert" class="status message">
|
||||
<h3 class="message-title">We're Sorry, edX accounts are unavailable currently</h3>
|
||||
@@ -91,7 +94,7 @@
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<fieldset class="group group-form group-form-requiredinformation">
|
||||
@@ -100,7 +103,7 @@
|
||||
<ol class="list-input">
|
||||
<li class="field required text" id="field-email">
|
||||
<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 class="field required password" id="field-password">
|
||||
<label for="password">Password</label>
|
||||
|
||||
@@ -36,8 +36,10 @@
|
||||
|
||||
(function() {
|
||||
$(document).delegate('#register-form', 'ajax:success', function(data, json, xhr) {
|
||||
$(this).find('.form-actions #submit').addClass('is-disabled');
|
||||
|
||||
if(json.success) {
|
||||
$('.message.submission-error').removeClass('is-shown');
|
||||
$('.message.submission-error').removeClass('is-shown');
|
||||
toggleSubmitButton();
|
||||
location.href="${reverse('dashboard')}";
|
||||
} else {
|
||||
@@ -52,13 +54,14 @@
|
||||
function toggleSubmitButton(e) {
|
||||
var $msgError = $('form .status.submission-error');
|
||||
var $submitButton = $('form .form-actions #submit').prop('disabled', true);
|
||||
var $submitButtonCopy = $submitButton.html();
|
||||
|
||||
if(!$msgError.hasClass('is-shown')) {
|
||||
$submitButton.prop('disabled', true);
|
||||
$submitButton.prop('disabled', true).html('Processing your registration …');
|
||||
}
|
||||
|
||||
else {
|
||||
$submitButton.prop('disabled', false);
|
||||
$submitButton.prop('disabled', false).html($submitButtonCopy);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -77,7 +80,7 @@
|
||||
</header>
|
||||
|
||||
<form role="form" id="register-form" method="post" data-remote="true" action="/create_account">
|
||||
|
||||
|
||||
<!-- status messages -->
|
||||
<div role="alert" class="status message">
|
||||
<h3 class="message-title">We're sorry, edX enrollment is not available in your region</h3>
|
||||
@@ -91,7 +94,7 @@
|
||||
|
||||
<p class="instructions">
|
||||
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>
|
||||
|
||||
<fieldset class="group group-form group-form-requiredinformation">
|
||||
@@ -102,7 +105,7 @@
|
||||
<ol class="list-input">
|
||||
<li class="field required text" id="field-email">
|
||||
<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 class="field required password" id="field-password">
|
||||
<label for="password">Password</label>
|
||||
@@ -236,4 +239,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>
|
||||
</div>
|
||||
</aside>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user