Commit bbed49db by Tom Giannattasio

styled log in and sign up errors; fixed expand/collapse transition bug

parent 07ac0d06
...@@ -65,6 +65,7 @@ input.courseware-unit-search-input { ...@@ -65,6 +65,7 @@ input.courseware-unit-search-input {
.expand-collapse-icon { .expand-collapse-icon {
float: left; float: left;
margin: 16px 6px 16px 16px; margin: 16px 6px 16px 16px;
@include transition(none);
} }
.drag-handle { .drag-handle {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
height: 11px; height: 11px;
margin-right: 10px; margin-right: 10px;
background: url(../img/expand-collapse-icons.png) no-repeat; background: url(../img/expand-collapse-icons.png) no-repeat;
@include transition(none);
&.expand { &.expand {
top: 1px; top: 1px;
......
...@@ -77,4 +77,15 @@ ...@@ -77,4 +77,15 @@
text-align: right; text-align: right;
font-size: 13px; 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;
}
} }
\ No newline at end of file
...@@ -30,36 +30,40 @@ ...@@ -30,36 +30,40 @@
<script type="text/javascript"> <script type="text/javascript">
(function() { (function() {
function getCookie(name) { function getCookie(name) {
return $.cookie(name); return $.cookie(name);
} }
function postJSON(url, data, callback) { function postJSON(url, data, callback) {
$.ajax({type:'POST', $.ajax({type:'POST',
url: url, url: url,
dataType: 'json', dataType: 'json',
data: data, data: data,
success: callback, success: callback,
headers : {'X-CSRFToken':getCookie('csrftoken')} headers : {'X-CSRFToken':getCookie('csrftoken')}
}); });
} }
$('form#login_form').submit(function(e) { $('form#login_form').submit(function(e) {
e.preventDefault(); e.preventDefault();
var submit_data = $('#login_form').serialize(); var submit_data = $('#login_form').serialize();
postJSON('/login_post', postJSON('/login_post',
submit_data, submit_data,
function(json) { function(json) {
if(json.success) { if(json.success) {
location.href="${reverse('index')}"; console.log('success');
location.href = "${reverse('index')}";
} else if($('#login_error').length == 0) { } 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 { } else {
$('#login_error').stop().css("background-color", "#933").animate({ backgroundColor: "#333"}, 2000); console.log('error 2');
$('#login_error').stop().slideDown(150);
} }
} }
); );
}); });
})(this) })(this)
</script> </script>
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
if(json.success) { if(json.success) {
$('#register').html(json.value); $('#register').html(json.value);
} else { } else {
$('#register_error').html(json.value).stop().css("background-color", "#933").animate({ backgroundColor: "#333"}, 2000); $('#register_error').html(json.value).stop().slideDown(150);
} }
} }
); );
......
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