main • app/views/pulls/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']) ?> • PR #<?= (int)$pr['number'] ?></h4>
<div class="text-muted"><?= e($pr['title']) ?></div>
<div class="small text-muted mono"><?= e($pr['source_branch']) ?> → <?= e($pr['target_branch']) ?> • by <?= e($pr['author_name']) ?></div>
</div>
<a class="btn btn-outline-dark btn-sm" href="/r/<?= (int)$repo['id'] ?>/pulls">Back</a>
</div>
<?php if ($pr['state']==='open' && $canWrite): ?>
<form method="post" action="/r/<?= (int)$repo['id'] ?>/pulls/<?= (int)$pr['number'] ?>/merge" class="mb-3">
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
<button class="btn btn-success" onclick="return confirm('Fast-forward merge this PR?');">Merge (Fast-forward)</button>
</form>
<?php endif; ?>
<div class="card p-3 mb-3">
<div class="fw-bold mb-2">Description</div>
<div><?= nl2br(e($pr['body'] ?? '')) ?></div>
</div>
<div class="card p-3">
<div class="fw-bold mb-2">Changes</div>
<?php if (!$changes): ?>
<div class="text-muted">No differences (branches identical).</div>
<?php endif; ?>
<?php foreach ($changes as $ch): ?>
<div class="mt-3">
<div class="d-flex justify-content-between align-items-center">
<div class="mono fw-bold"><?= e($ch['path']) ?></div>
<span class="badge bg-secondary"><?= e($ch['type']) ?></span>
</div>
<?php if ($ch['type'] === 'modified'): ?>
<?php
$old = $blobs->readBlobById($db, (int)$ch['a']);
$new = $blobs->readBlobById($db, (int)$ch['b']);
$lines = $diffEngine->lineDiff($old, $new);
?>
<div class="mt-2">
<?= $diffEngine->renderLineDiffHtml($lines) ?>
</div>
<?php else: ?>
<div class="text-muted small mt-1">Preview for added/deleted can be added next.</div>
<?php endif; ?>
<hr>
</div>
<?php endforeach; ?>
</div>
<?php require __DIR__ . '/../layout/footer.php'; ?>