| 1 |
{%- import "partials/_ui.html" as ui -%} |
| 2 |
{% if git_enabled %} |
| 3 |
<div id="tab-project-code-cfg" hidden data-project-id="{{ project.id }}" data-project-slug="{{ project.slug }}"></div> |
| 4 |
<div class="tab-docs"><a href="/docs/git">Docs: Git →</a> <a href="/dashboard#tab-ssh-keys" class="proj-code-docs-link">Manage SSH Keys →</a></div> |
| 5 |
|
| 6 |
<div class="form-section" id="git-repos-section"> |
| 7 |
<h2 class="subsection-title">Git Repositories</h2> |
| 8 |
|
| 9 |
{% if !linked_repos.is_empty() %} |
| 10 |
<div class="proj-code-linked-list"> |
| 11 |
<label>Linked Repositories</label> |
| 12 |
{% for repo in &linked_repos %} |
| 13 |
<div class="proj-code-repo"> |
| 14 |
<div class="proj-code-repo-row"> |
| 15 |
<a href="/git/{{ repo.name }}" class="proj-code-repo-link">{{ repo.name }}</a> |
| 16 |
<button class="btn-danger" |
| 17 |
hx-delete="/api/projects/{{ project.id }}/repos/{{ repo.name }}" |
| 18 |
hx-target="#git-repos-section" |
| 19 |
hx-swap="outerHTML" |
| 20 |
hx-confirm="Unlink '{{ repo.name }}' from this project?">Unlink</button> |
| 21 |
</div> |
| 22 |
{% if !repo.collaborators.is_empty() %} |
| 23 |
<div class="proj-code-collab-block"> |
| 24 |
<label class="proj-code-collab-label">Collaborators</label> |
| 25 |
{% for c in &repo.collaborators %} |
| 26 |
<div class="proj-code-collab-row"> |
| 27 |
<span class="proj-code-collab-name">@{{ c.username }}{% if !c.can_push %} <span class="proj-code-collab-readonly">(read only)</span>{% endif %}</span> |
| 28 |
<button class="btn-danger small" |
| 29 |
hx-delete="/api/repos/{{ repo.id }}/collaborators/{{ c.user_id }}" |
| 30 |
hx-target="#git-repos-section" |
| 31 |
hx-swap="outerHTML" |
| 32 |
hx-confirm="Remove @{{ c.username }} from {{ repo.name }}?">Remove</button> |
| 33 |
</div> |
| 34 |
{% endfor %} |
| 35 |
</div> |
| 36 |
{% endif %} |
| 37 |
<div class="proj-code-collab-block"> |
| 38 |
<div class="proj-code-add-collab-row"> |
| 39 |
<input type="text" placeholder="Username" class="collab-username-input" data-repo-id="{{ repo.id }}"> |
| 40 |
<button class="btn-secondary small collab-add-btn" data-repo-id="{{ repo.id }}">Add Collaborator</button> |
| 41 |
</div> |
| 42 |
</div> |
| 43 |
</div> |
| 44 |
{% endfor %} |
| 45 |
</div> |
| 46 |
<script src="/static/tab-project-code-collab.js?v=0623"></script> |
| 47 |
{% endif %} |
| 48 |
|
| 49 |
{% if !available_repos.is_empty() %} |
| 50 |
<div> |
| 51 |
<label for="link-repo-select">Link a Repository</label> |
| 52 |
<div class="proj-code-link-row"> |
| 53 |
<select id="link-repo-select"> |
| 54 |
<option value="">Select a repository...</option> |
| 55 |
{% for repo in &available_repos %} |
| 56 |
<option value="{{ repo.name }}">{{ repo.name }}</option> |
| 57 |
{% endfor %} |
| 58 |
</select> |
| 59 |
<button class="btn-secondary" id="link-repo-btn">Link</button> |
| 60 |
</div> |
| 61 |
<div class="hint">Choose from your unlinked repositories.</div> |
| 62 |
</div> |
| 63 |
<script src="/static/tab-project-code-link.js?v=0623"></script> |
| 64 |
{% else if linked_repos.is_empty() %} |
| 65 |
{% call ui::empty_state("", "No repositories available. Create one below or push to the server.") %}{% endcall %} |
| 66 |
{% endif %} |
| 67 |
|
| 68 |
<div class="proj-code-create-section"> |
| 69 |
<label for="create-repo-name">Create Repository</label> |
| 70 |
<div class="proj-code-link-row"> |
| 71 |
<input type="text" id="create-repo-name" placeholder="repo-name" pattern="[a-zA-Z0-9._-]+" title="Letters, numbers, hyphens, underscores, and dots"> |
| 72 |
<button class="btn-secondary" id="create-repo-btn">Create</button> |
| 73 |
</div> |
| 74 |
<div class="hint">Creates a bare git repository on the server.</div> |
| 75 |
<div id="create-repo-status" class="proj-code-create-status"></div> |
| 76 |
</div> |
| 77 |
<script src="/static/tab-project-code-create.js?v=0623"></script> |
| 78 |
</div> |
| 79 |
{% else %} |
| 80 |
<div class="proj-code-disabled"> |
| 81 |
<p>Git hosting is not configured on this server.</p> |
| 82 |
</div> |
| 83 |
{% endif %} |
| 84 |
|