Fixed API refresh status spin not working.

This commit is contained in:
neviyn 2016-03-13 19:17:47 +00:00
parent 169a13c01b
commit 2f5dd712c8
3 changed files with 7 additions and 7 deletions

View File

@ -133,15 +133,15 @@ $("#get-help").click (e) ->
$("#api-refresh").click (e) -> $("#api-refresh").click (e) ->
e.preventDefault(); e.preventDefault();
$("#api-refresh").find('span').addClass('glyphicon-spin'); $("#api-refresh").find('img').addClass('glyphicon-spin');
$.post("/refresh").success(() -> $.post("/refresh").success(() ->
refreshQuestion(); refreshQuestion();
$("#api-refresh").find('span').removeClass('glyphicon-spin'); $("#api-refresh").find('img').removeClass('glyphicon-spin');
$('#success-area').show(); $('#success-area').show();
).fail(() -> ).fail(() ->
$('#error-area').show(); $('#error-area').show();
$('#error-text').text("Cannot refresh API. Try again later.") $('#error-text').text("Cannot refresh API. Try again later.")
$("#api-refresh").find('span').removeClass('glyphicon-spin'); $("#api-refresh").find('img').removeClass('glyphicon-spin');
); );
$('#error-area').find('button').click () -> $('#error-area').find('button').click () ->

View File

@ -195,15 +195,15 @@
$("#api-refresh").click(function(e) { $("#api-refresh").click(function(e) {
e.preventDefault(); e.preventDefault();
$("#api-refresh").find('span').addClass('glyphicon-spin'); $("#api-refresh").find('img').addClass('glyphicon-spin');
return $.post("/refresh").success(function() { return $.post("/refresh").success(function() {
refreshQuestion(); refreshQuestion();
$("#api-refresh").find('span').removeClass('glyphicon-spin'); $("#api-refresh").find('img').removeClass('glyphicon-spin');
return $('#success-area').show(); return $('#success-area').show();
}).fail(function() { }).fail(function() {
$('#error-area').show(); $('#error-area').show();
$('#error-text').text("Cannot refresh API. Try again later."); $('#error-text').text("Cannot refresh API. Try again later.");
return $("#api-refresh").find('span').removeClass('glyphicon-spin'); return $("#api-refresh").find('img').removeClass('glyphicon-spin');
}); });
}); });

View File

@ -59,7 +59,7 @@
<li><span id="total-num"></span> Total</li> <li><span id="total-num"></span> Total</li>
</ul> </ul>
</li> </li>
<li id="api-refresh" class="navbar-text" data-html="true" data-toggle="tooltip" data-placement="bottom" title="Last API Refresh:<br>{{ current_user.last_updated|datetime_format }}<br>Click to refresh"><span><img alt="avatar" src="http://www.gravatar.com/avatar/{{ current_user.gravatar }}?s=24"></span> {{ current_user.username }}</li> <li id="api-refresh" class="navbar-text" data-html="true" data-toggle="tooltip" data-placement="bottom" title="Last API Refresh:<br>{{ current_user.last_updated|datetime_format }}<br>Click to refresh"><img alt="avatar" src="http://www.gravatar.com/avatar/{{ current_user.gravatar }}?s=24"> {{ current_user.username }}</li>
<li><a href="{{ url_for('logout') }}">Logout</a></li> <li><a href="{{ url_for('logout') }}">Logout</a></li>
</ul> </ul>
</div> </div>