styled log in and sign up errors; fixed expand/collapse transition bug
This commit is contained in:
@@ -65,6 +65,7 @@ input.courseware-unit-search-input {
|
||||
.expand-collapse-icon {
|
||||
float: left;
|
||||
margin: 16px 6px 16px 16px;
|
||||
@include transition(none);
|
||||
}
|
||||
|
||||
.drag-handle {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
height: 11px;
|
||||
margin-right: 10px;
|
||||
background: url(../img/expand-collapse-icons.png) no-repeat;
|
||||
@include transition(none);
|
||||
|
||||
&.expand {
|
||||
top: 1px;
|
||||
|
||||
@@ -77,4 +77,15 @@
|
||||
text-align: right;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#login_error,
|
||||
#register_error {
|
||||
display: none;
|
||||
margin-bottom: 30px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3px;
|
||||
background: $error-red;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
@@ -30,36 +30,40 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
function getCookie(name) {
|
||||
return $.cookie(name);
|
||||
}
|
||||
function postJSON(url, data, callback) {
|
||||
$.ajax({type:'POST',
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: callback,
|
||||
headers : {'X-CSRFToken':getCookie('csrftoken')}
|
||||
});
|
||||
}
|
||||
function getCookie(name) {
|
||||
return $.cookie(name);
|
||||
}
|
||||
function postJSON(url, data, callback) {
|
||||
$.ajax({type:'POST',
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: callback,
|
||||
headers : {'X-CSRFToken':getCookie('csrftoken')}
|
||||
});
|
||||
}
|
||||
|
||||
$('form#login_form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var submit_data = $('#login_form').serialize();
|
||||
$('form#login_form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var submit_data = $('#login_form').serialize();
|
||||
|
||||
postJSON('/login_post',
|
||||
submit_data,
|
||||
function(json) {
|
||||
if(json.success) {
|
||||
location.href="${reverse('index')}";
|
||||
postJSON('/login_post',
|
||||
submit_data,
|
||||
function(json) {
|
||||
if(json.success) {
|
||||
console.log('success');
|
||||
location.href = "${reverse('index')}";
|
||||
} else if($('#login_error').length == 0) {
|
||||
$('#login_form').prepend('<div id="login_error">Email or password is incorrect.</div>');
|
||||
console.log('error 1');
|
||||
$('#login_form').prepend('<div id="login_error">Email or password is incorrect.</div>');
|
||||
$('#login_error').slideDown(150);
|
||||
} else {
|
||||
$('#login_error').stop().css("background-color", "#933").animate({ backgroundColor: "#333"}, 2000);
|
||||
console.log('error 2');
|
||||
$('#login_error').stop().slideDown(150);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
})(this)
|
||||
</script>
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
if(json.success) {
|
||||
$('#register').html(json.value);
|
||||
} else {
|
||||
$('#register_error').html(json.value).stop().css("background-color", "#933").animate({ backgroundColor: "#333"}, 2000);
|
||||
$('#register_error').html(json.value).stop().slideDown(150);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user