Added success message for api refresh.

This commit is contained in:
neviyn 2015-10-06 00:03:07 +01:00
parent af1b647b5d
commit d3d6b142d9
3 changed files with 18 additions and 3 deletions

View File

@ -67,11 +67,17 @@ $("#get-help").click (e) ->
$("#api-refresh").click (e) -> $("#api-refresh").click (e) ->
e.preventDefault(); e.preventDefault();
$.post("/refresh").success(() -> refreshQuestion()).fail(() -> $('#error-area').show()); $.post("/refresh").success(() ->
refreshQuestion()
$('#success-area').show()
).fail(() -> $('#error-area').show());
$('#error-area').find('button').click () -> $('#error-area').find('button').click () ->
$('#error-area').hide() $('#error-area').hide()
$('#success-area').find('button').click () ->
$('#success-area').hide()
$ -> $ ->
$(document).ready -> $(document).ready ->
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();

View File

@ -91,7 +91,8 @@
$("#api-refresh").click(function(e) { $("#api-refresh").click(function(e) {
e.preventDefault(); e.preventDefault();
return $.post("/refresh").success(function() { return $.post("/refresh").success(function() {
return refreshQuestion(); refreshQuestion();
return $('#success-area').show();
}).fail(function() { }).fail(function() {
return $('#error-area').show(); return $('#error-area').show();
}); });
@ -101,6 +102,10 @@
return $('#error-area').hide(); return $('#error-area').hide();
}); });
$('#success-area').find('button').click(function() {
return $('#success-area').hide();
});
$(function() { $(function() {
return $(document).ready(function() { return $(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();

View File

@ -30,7 +30,11 @@
<div class="row"> <div class="row">
<div class="col-md-12 text-center"> <div class="col-md-12 text-center">
<div id="error-area" class="alert alert-danger alert-dismissible collapse" role="alert"> <div id="error-area" class="alert alert-danger alert-dismissible collapse" role="alert">
<button type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>Cannot refresh API. Try again later.</div> <button type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>Cannot refresh API. Try again later.
</div>
<div id="success-area" class="alert alert-danger alert-dismissible collapse" role="alert">
<button type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>API Refreshed!
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">