diff --git a/resources/views/admin/questions/index.blade.php b/resources/views/admin/questions/index.blade.php index a746205..c6a4947 100644 --- a/resources/views/admin/questions/index.blade.php +++ b/resources/views/admin/questions/index.blade.php @@ -35,10 +35,10 @@ + data-question-text="{{ base64_encode($question->question_text) }}" + data-answers="{{ base64_encode($question->answers->toJson()) }}" + data-matching-pairs="{{ base64_encode($question->matchingPairs->toJson()) }}" + data-ordering-items="{{ base64_encode($question->orderingItems->toJson()) }}"> {{ Str::limit(strip_tags($question->question_text), 100) }} @@ -89,10 +89,10 @@ document.addEventListener('DOMContentLoaded', function() { previewModal.addEventListener('show.bs.modal', function(event) { const button = event.relatedTarget; const questionType = button.getAttribute('data-question-type'); - const questionText = button.getAttribute('data-question-text'); - const answers = JSON.parse(button.getAttribute('data-answers')); - const matchingPairs = JSON.parse(button.getAttribute('data-matching-pairs') || '[]'); - const orderingItems = JSON.parse(button.getAttribute('data-ordering-items') || '[]'); + const questionText = atob(button.getAttribute('data-question-text')); + const answers = JSON.parse(atob(button.getAttribute('data-answers'))); + const matchingPairs = JSON.parse(atob(button.getAttribute('data-matching-pairs') || 'bnVsbA==')); + const orderingItems = JSON.parse(atob(button.getAttribute('data-ordering-items') || 'bnVsbA==')); // Отображаем текст вопроса document.getElementById('modalQuestionText').innerHTML = questionText; @@ -123,19 +123,27 @@ document.addEventListener('DOMContentLoaded', function() { answersContainer.appendChild(div); }); } else if (questionType === 'matching') { - let html = '
| Левая часть | Правая часть |
|---|---|
| ${pair.left_text} | ${pair.right_text} |
| Левая часть | Правая часть |
|---|---|
| ${pair.left_text} | ${pair.right_text} |
Нет пар для соответствия
'; + } } else if (questionType === 'ordering') { - let html = 'Нет элементов для сортировки
'; + } } }); });