main • app/views/repos/branches.php
<?php require __DIR__ . '/../layout/header.php'; ?>
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="m-0"><?= e($repo['owner_username']) ?>/<?= e($repo['name']) ?> • Branches</h4>
<a class="btn btn-outline-dark btn-sm" href="/r/<?= (int)$repo['id'] ?>">Back</a>
</div>
<?php if ($canWrite): ?>
<div class="card p-3 mb-3">
<h5 class="mb-3">Create branch</h5>
<form method="post" action="/r/<?= (int)$repo['id'] ?>/branches">
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
<div class="row g-2 align-items-end">
<div class="col-md-4">
<label class="form-label">From branch</label>
<select class="form-select" name="from_branch">
<?php foreach ($branches as $b): ?>
<option value="<?= e($b['name']) ?>"><?= e($b['name']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-md-5">
<label class="form-label">New branch name</label>
<input class="form-control" name="new_branch" placeholder="feature/login-ui" required>
</div>
<div class="col-md-3">
<button class="btn btn-dark w-100">Create</button>
</div>
</div>
</form>
</div>
<?php endif; ?>
<div class="card p-3">
<h5 class="mb-3">Existing branches</h5>
<div class="list-group">
<?php foreach ($branches as $b): ?>
<a class="list-group-item list-group-item-action d-flex justify-content-between align-items-center"
href="/r/<?= (int)$repo['id'] ?>/browse?branch=<?= e($b['name']) ?>">
<span class="mono"><?= e($b['name']) ?></span>
<span class="small text-muted">head: <?= $b['head_commit_id'] ? '#'.(int)$b['head_commit_id'] : 'none' ?></span>
</a>
<?php endforeach; ?>
</div>
</div>
<?php require __DIR__ . '/../layout/footer.php'; ?>