Embed AI fallback in PDF comment block
This commit is contained in:
@@ -47,8 +47,9 @@ $resolveImageUrl = static function ($path) {
|
||||
document.querySelectorAll('.result-pdf-comment').forEach(function (commentBlock) {
|
||||
const questionId = commentBlock.dataset.questionId;
|
||||
const manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || '';
|
||||
const storedAiFeedback = commentBlock.querySelector('.result-pdf-ai-source')?.textContent.trim() || '';
|
||||
const visibleAiFeedback = document.querySelector('.ai-feedback-screen[data-question-id="' + questionId + '"] .ai-feedback-text')?.textContent.trim() || '';
|
||||
const aiComment = visibleAiFeedback || commentBlock.dataset.aiComment || '';
|
||||
const aiComment = storedAiFeedback || visibleAiFeedback;
|
||||
const output = commentBlock.querySelector('.result-pdf-comment-text');
|
||||
|
||||
if (output) {
|
||||
@@ -147,6 +148,7 @@ $resolveImageUrl = static function ($path) {
|
||||
<div class="result-pdf-comment mt-3" data-question-id="<?php echo (int) $questionId; ?>" data-ai-comment="<?php echo htmlspecialchars($aiComment, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_COMMENT'); ?>:</strong><br>
|
||||
<span class="result-pdf-comment-text"><?php echo htmlspecialchars($printComment !== '' ? $printComment : '—', ENT_QUOTES, 'UTF-8'); ?></span>
|
||||
<span class="result-pdf-ai-source" hidden><?php echo htmlspecialchars($aiComment, ENT_QUOTES, 'UTF-8'); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (empty($answer['correct'])) : ?>
|
||||
|
||||
Reference in New Issue
Block a user