main • app/views/issues/show.php
<?php require __DIR__ . '/../layout/header.php'; ?>
<div class="d-flex justify-content-between align-items-center mb-3">
<div>
<h4 class="m-0"><?= e($repo['owner_username']) ?>/<?= e($repo['name']) ?> • Issue #<?= (int)$issue['number'] ?></h4>
<div class="text-muted"><?= e($issue['title']) ?></div>
<div class="small text-muted">by <?= e($issue['author_name']) ?> • <?= e($issue['created_at']) ?></div>
</div>
<a class="btn btn-outline-dark btn-sm" href="/r/<?= (int)$repo['id'] ?>/issues">Back</a>
</div>
<div class="card p-3 mb-3">
<div class="d-flex justify-content-between">
<span class="badge bg-secondary"><?= e($issue['state']) ?></span>
<?php if ($canWrite): ?>
<form method="post" action="/r/<?= (int)$repo['id'] ?>/issues/<?= (int)$issue['number'] ?>/toggle">
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
<button class="btn btn-sm btn-outline-dark">
<?= $issue['state']==='open' ? 'Close' : 'Reopen' ?>
</button>
</form>
<?php endif; ?>
</div>
<hr>
<div><?= nl2br(e($issue['body'] ?? '')) ?></div>
</div>
<div class="card p-3">
<h5>Comments</h5>
<?php if (!$comments): ?><div class="text-muted">No comments yet.</div><?php endif; ?>
<?php foreach ($comments as $c): ?>
<div class="border rounded p-2 mb-2">
<div class="small text-muted"><?= e($c['user_name']) ?> • <?= e($c['created_at']) ?></div>
<div><?= nl2br(e($c['body'])) ?></div>
</div>
<?php endforeach; ?>
<?php if ($canWrite): ?>
<hr>
<form method="post" action="/r/<?= (int)$repo['id'] ?>/issues/<?= (int)$issue['number'] ?>/comment">
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
<textarea class="form-control mb-2" name="body" rows="3" placeholder="Write a comment..." required></textarea>
<button class="btn btn-dark btn-sm">Comment</button>
</form>
<?php endif; ?>
</div>
<?php require __DIR__ . '/../layout/footer.php'; ?>