fix paste button for comment review spring

This commit is contained in:
root
2026-05-29 00:18:12 -04:00
parent b4a06903e2
commit ce56c96cdd
+12 -12
View File
@@ -177,7 +177,10 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
</td>
<?php elseif ($semester === 'Spring'): ?>
<td>
<?php $finalCommentId = 'final-comment-' . $studentId; ?>
<?php $finalReviewId = 'final-review-' . $studentId; ?>
<textarea
id="<?= esc($finalCommentId) ?>"
name="comments[<?= $studentId ?>][final]"
rows="2"
class="form-control"
@@ -186,7 +189,6 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
maxlength="350"
placeholder="Enter Final comment" <?= $lockAttr ?>><?= esc($comments[$studentId]['final']['comment'] ?? '') ?></textarea>
</td>
<?php $finalReviewId = 'final-review-' . $studentId; ?>
<td>
<div class="d-flex gap-2 align-items-start">
<textarea
@@ -196,6 +198,13 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
class="form-control review-field"
placeholder="Enter Final review" <?= $lockAttr ?>><?= esc($comments[$studentId]['final']['comment_review'] ?? '') ?></textarea>
<div class="d-flex flex-column gap-1 align-items-stretch">
<button
type="button"
class="btn btn-outline-secondary btn-sm copy-final-btn"
data-copy-source="#<?= esc($finalCommentId) ?>"
data-copy-target="#<?= esc($finalReviewId) ?>" <?= $lockAttr ?>>
Paste
</button>
<div class="small text-muted proofread-status" data-status-for="<?= esc($finalReviewId) ?>"></div>
<ul class="proofread-list small mb-0" data-list-for="<?= esc($finalReviewId) ?>"></ul>
</div>
@@ -474,18 +483,9 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
});
};
document.querySelectorAll('.copy-ptap-btn').forEach(button => {
button.addEventListener('click', function() {
const source = document.querySelector(this.dataset.copySource || '');
const target = document.querySelector(this.dataset.copyTarget || '');
if (!source || !target) return;
target.value = source.value;
target.style.height = 'auto';
target.style.height = (target.scrollHeight) + 'px';
target.focus();
});
});
wireCopyButtons('.copy-ptap-btn');
wireCopyButtons('.copy-midterm-btn');
wireCopyButtons('.copy-final-btn');
});
</script>
<?= $this->endSection() ?>