From d3d6b142d99526b9df0636c69b809c698ac56bf5 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Tue, 6 Oct 2015 00:03:07 +0100 Subject: [PATCH] Added success message for api refresh. --- static/quiz_item.coffee | 8 +++++++- static/quiz_item.js | 7 ++++++- templates/quiz.html | 6 +++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/static/quiz_item.coffee b/static/quiz_item.coffee index fba391d..cce90a6 100644 --- a/static/quiz_item.coffee +++ b/static/quiz_item.coffee @@ -67,11 +67,17 @@ $("#get-help").click (e) -> $("#api-refresh").click (e) -> 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').hide() +$('#success-area').find('button').click () -> + $('#success-area').hide() + $ -> $(document).ready -> $('[data-toggle="tooltip"]').tooltip(); diff --git a/static/quiz_item.js b/static/quiz_item.js index e728441..ae65179 100644 --- a/static/quiz_item.js +++ b/static/quiz_item.js @@ -91,7 +91,8 @@ $("#api-refresh").click(function(e) { e.preventDefault(); return $.post("/refresh").success(function() { - return refreshQuestion(); + refreshQuestion(); + return $('#success-area').show(); }).fail(function() { return $('#error-area').show(); }); @@ -101,6 +102,10 @@ return $('#error-area').hide(); }); + $('#success-area').find('button').click(function() { + return $('#success-area').hide(); + }); + $(function() { return $(document).ready(function() { $('[data-toggle="tooltip"]').tooltip(); diff --git a/templates/quiz.html b/templates/quiz.html index a4b7dd2..fa43a15 100644 --- a/templates/quiz.html +++ b/templates/quiz.html @@ -30,7 +30,11 @@
+ Cannot refresh API. Try again later. +
+