From f0fcaf8980c94826db8c969655b719afa77f1623 Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 8 Jul 2021 16:48:40 +0100 Subject: [PATCH] . --- .../rapids/question_display_block.html | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/rapids/templates/rapids/question_display_block.html b/rapids/templates/rapids/question_display_block.html index 38154a6a..5fa4d593 100755 --- a/rapids/templates/rapids/question_display_block.html +++ b/rapids/templates/rapids/question_display_block.html @@ -8,7 +8,12 @@ class="toggle-button">toggle

Region: {{ question.get_regions }}

Examination: {{ question.get_examinations }}

-

Laterality: {{ question.laterality }}

+

Laterality: {{ question.laterality }} + + + + +

Abnormality: {{ question.get_abnormalities }}

Images: {% for image in question.images.all %} @@ -106,14 +111,37 @@ }) .done(function (data) { console.log(data); - toastr.info('Answer saved') + toastr.info('Answer updated') }) .fail(function () { alert('Error updating this model instance.'); - //chk_status_field.prop('checked', !chk_status_field.prop('checked')); }); }); + $(".toggle-laterality-button").each((n, el) => { + $(el).click(function () { + $.ajax({ + url: "{% url 'rapid-detail' question.id %}", + type: 'PATCH', + headers: { + "X-CSRFToken": "{{ csrf_token }}" + }, + timeout: 3000, + data: { + csrfmiddlewaretoken: "{{ csrf_token }}", + laterality: el.dataset.lat, + } + }) + .done(function (data) { + console.log(data); + toastr.info('Answer updated') + }) + .fail(function () { + alert('Error updating this model instance.'); + }); + }); + }); + $(".suggested_answers li").each((n, el) => { $(el).append($("[Add Correct]").on("click", function () { $.ajax({