From d40fec3e6a14a9fb7ea33891af12c3addcceb611 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 7 Jul 2021 18:04:05 +0100 Subject: [PATCH] . --- rad/views.py | 1 + rapids/templates/rapids/question_display_block.html | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rad/views.py b/rad/views.py index ca9a57d1..2b858214 100644 --- a/rad/views.py +++ b/rad/views.py @@ -275,6 +275,7 @@ def answer_submit(request): a = AnswerModel(question=q, answer=answer_string, status=status) a.save() + return JsonResponse({"success": True, "error": "Answer added"}) return JsonResponse({"success": False, "error": "Invalid data"}) diff --git a/rapids/templates/rapids/question_display_block.html b/rapids/templates/rapids/question_display_block.html index 228477e3..7e486896 100755 --- a/rapids/templates/rapids/question_display_block.html +++ b/rapids/templates/rapids/question_display_block.html @@ -121,7 +121,7 @@ $(".proposed-answer").each((n, el) => { // Add button to confirm answer is correct - $(el).append($("[Correct]").on("click", function () { + $(el).append($("[Add Correct]").on("click", function () { $.ajax({ url: "{% url 'answer_suggestion_confirm' %}", data: { @@ -139,9 +139,8 @@ console.log(data); if (data.success) { - toastr.info('Answer saved') - $(el).find(".confirm").remove() - $(el).removeClass("proposed-answer") + toastr.info('Answer added') + $(el).find(".correct").remove() } // show some message according to the response. // For eg. A message box showing that the status has been changed