Added visual indicator for while waiting for API refresh response.

This commit is contained in:
neviyn 2015-10-07 18:39:36 +01:00
parent 6dfec65935
commit 451083cf0b
3 changed files with 37 additions and 4 deletions

View File

@ -67,10 +67,15 @@ $("#get-help").click (e) ->
$("#api-refresh").click (e) ->
e.preventDefault();
$("#api-refresh").find('span').addClass('glyphicon-spin');
$.post("/refresh").success(() ->
refreshQuestion()
$('#success-area').show()
).fail(() -> $('#error-area').show());
refreshQuestion();
$("#api-refresh").find('span').removeClass('glyphicon-spin');
$('#success-area').show();
).fail(() ->
$('#error-area').show();
$("#api-refresh").find('span').removeClass('glyphicon-spin');
);
$('#error-area').find('button').click () ->
$('#error-area').hide()

View File

@ -90,11 +90,14 @@
$("#api-refresh").click(function(e) {
e.preventDefault();
$("#api-refresh").find('span').addClass('glyphicon-spin');
return $.post("/refresh").success(function() {
refreshQuestion();
$("#api-refresh").find('span').removeClass('glyphicon-spin');
return $('#success-area').show();
}).fail(function() {
return $('#error-area').show();
$('#error-area').show();
return $("#api-refresh").find('span').removeClass('glyphicon-spin');
});
});

View File

@ -46,3 +46,28 @@ body{
.navbar-text > a > img{
max-height: 26px;
}
.glyphicon-spin {
-webkit-animation: spin 1000ms infinite linear;
animation: spin 1000ms infinite linear;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}