From 3801f56b2110b56ec4d43f24f35d861665ad06c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Wed, 19 Jun 2024 18:23:31 +0300 Subject: [PATCH] refactor: [AXM-361] refactor block disabling --- lms/static/js/courseware/bridge.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lms/static/js/courseware/bridge.js b/lms/static/js/courseware/bridge.js index 27dee3f61012..5fb67b37baf1 100644 --- a/lms/static/js/courseware/bridge.js +++ b/lms/static/js/courseware/bridge.js @@ -17,13 +17,16 @@ function markProblemCompletedAndroid(message) { function markProblemCompleted(message) { const data = JSON.parse(message).data; - const problem = new Problem($(".xblock-student_view")); - problem.submitButton.attr({disabled: "disabled"}); - problem.gentle_alert("Answer submitted."); + const prob = $(".xblock-student_view"); + prob.find('.submit-attempt-container .submit').attr({disabled: "disabled"}); + prob.find('.notification-gentle-alert .notification-message').html("Answer submitted."); + prob.find('.notification-gentle-alert').show(); + data.split("&").forEach(function (item) { - const [, answer] = item.split('=', 2); - problem.el.find('input[id$="' + answer + '"]').each(function () { + const [input, answer] = item.split('=', 2); + prob.find('input[id$="' + answer + '"], input[id$="' + input + '"]').each(function () { + $(this).attr({disabled: "disabled"}) if (this.type === "checkbox" || this.type === "radio") { this.checked = true; } else {