branches.html
·
129 lines
·
6.6 KB
| 1 | {{define "content"}} |
| 2 | <div class="container"> |
| 3 | {{template "repo_header" .}} |
| 4 | |
| 5 | <!-- Branches Section --> |
| 6 | <section class="card mb-4"> |
| 7 | <div class="card-header"> |
| 8 | <span class="font-semibold flex items-center gap-2"> |
| 9 | {{icon "git-branch" "size-4"}} |
| 10 | <span>{{t .Lang "repo.branches"}} ({{len .BranchDetails}})</span> |
| 11 | </span> |
| 12 | </div> |
| 13 | |
| 14 | {{if and .CanWrite (not .IsEmpty)}} |
| 15 | <form method="post" action="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/branches" class="card-body flex items-center flex-wrap gap-2" style="border-bottom:1px solid hsl(var(--border));background:hsl(var(--muted));"> |
| 16 | <input type="hidden" name="_csrf" value="{{.CSRFToken}}"> |
| 17 | <input name="branch_name" type="text" class="input font-mono" style="flex:1 1 12rem;height:1.9rem;" placeholder="{{t .Lang "repo.branch.name_ph"}}" required maxlength="100"> |
| 18 | <select name="from_ref" class="select font-mono" style="flex:0 1 11rem;height:1.9rem;"> |
| 19 | {{range .BranchDetails}} |
| 20 | <option value="{{.Name}}" {{if .IsDefault}}selected{{end}}>{{.Name}}</option> |
| 21 | {{end}} |
| 22 | </select> |
| 23 | <button type="submit" class="btn btn-primary btn-sm" style="height:1.9rem;"> |
| 24 | {{icon "plus" "size-3.5"}} |
| 25 | <span>{{t .Lang "repo.branch.create"}}</span> |
| 26 | </button> |
| 27 | </form> |
| 28 | {{end}} |
| 29 | |
| 30 | {{if .BranchDetails}} |
| 31 | <div class="dense-list"> |
| 32 | {{range .BranchDetails}} |
| 33 | <div class="dense-row" style="min-height:2.6rem;padding:0.45rem 0.85rem;"> |
| 34 | <div class="flex items-center gap-2 min-w-0"> |
| 35 | {{icon "git-branch" "size-4"}} |
| 36 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{.Name}}" class="font-mono font-semibold text-sm">{{.Name}}</a> |
| 37 | {{if .IsDefault}} |
| 38 | <span class="badge badge-primary">{{t $.Lang "repo.branch.default"}}</span> |
| 39 | {{end}} |
| 40 | {{if .Subject}} |
| 41 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/commit/{{.Hash}}" class="text-xs text-muted truncate">— {{.Subject}}</a> |
| 42 | {{end}} |
| 43 | </div> |
| 44 | <div class="flex items-center gap-2 flex-shrink-0"> |
| 45 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/commit/{{.Hash}}" class="badge badge-outline font-mono">{{.ShortHash}}</a> |
| 46 | <span class="text-xs text-muted">{{timeAgo .UpdatedAt $.Lang}}</span> |
| 47 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/archive/{{.Name}}.zip" class="btn btn-ghost btn-icon" style="width:1.65rem;height:1.65rem;" title="{{t $.Lang "repo.download_zip"}}"> |
| 48 | {{icon "download" "size-3.5"}} |
| 49 | </a> |
| 50 | {{if and $.CanWrite (not .IsDefault)}} |
| 51 | <form method="post" action="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/branches/delete" style="margin:0;"> |
| 52 | <input type="hidden" name="_csrf" value="{{$.CSRFToken}}"> |
| 53 | <input type="hidden" name="branch_name" value="{{.Name}}"> |
| 54 | <button type="submit" class="btn btn-ghost btn-icon text-destructive" style="width:1.65rem;height:1.65rem;" title="{{t $.Lang "common.delete"}}"> |
| 55 | {{icon "trash" "size-3.5"}} |
| 56 | </button> |
| 57 | </form> |
| 58 | {{end}} |
| 59 | </div> |
| 60 | </div> |
| 61 | {{end}} |
| 62 | </div> |
| 63 | {{else}} |
| 64 | <div class="card-body text-xs text-muted">{{t .Lang "repo.no_commits"}}</div> |
| 65 | {{end}} |
| 66 | </section> |
| 67 | |
| 68 | <!-- Tags / Releases Section --> |
| 69 | <section class="card"> |
| 70 | <div class="card-header"> |
| 71 | <span class="font-semibold flex items-center gap-2"> |
| 72 | {{icon "tag" "size-4"}} |
| 73 | <span>{{t .Lang "repo.tags"}} ({{len .TagDetails}})</span> |
| 74 | </span> |
| 75 | </div> |
| 76 | |
| 77 | {{if and .CanWrite (not .IsEmpty)}} |
| 78 | <form method="post" action="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/tags" class="card-body flex items-center flex-wrap gap-2" style="border-bottom:1px solid hsl(var(--border));background:hsl(var(--muted));"> |
| 79 | <input type="hidden" name="_csrf" value="{{.CSRFToken}}"> |
| 80 | <input name="tag_name" type="text" class="input font-mono" style="flex:0 1 9rem;height:1.9rem;" placeholder="{{t .Lang "repo.tag.name_ph"}}" required maxlength="80"> |
| 81 | <select name="from_ref" class="select font-mono" style="flex:0 1 10rem;height:1.9rem;"> |
| 82 | {{range .BranchDetails}} |
| 83 | <option value="{{.Name}}" {{if .IsDefault}}selected{{end}}>{{.Name}}</option> |
| 84 | {{end}} |
| 85 | </select> |
| 86 | <input name="message" type="text" class="input" style="flex:1 1 12rem;height:1.9rem;" placeholder="{{t .Lang "repo.tag.msg_ph"}}" maxlength="200"> |
| 87 | <button type="submit" class="btn btn-outline btn-sm" style="height:1.9rem;"> |
| 88 | {{icon "plus" "size-3.5"}} |
| 89 | <span>{{t .Lang "repo.tag.create"}}</span> |
| 90 | </button> |
| 91 | </form> |
| 92 | {{end}} |
| 93 | |
| 94 | {{if .TagDetails}} |
| 95 | <div class="dense-list"> |
| 96 | {{range .TagDetails}} |
| 97 | <div class="dense-row" style="min-height:2.6rem;padding:0.45rem 0.85rem;"> |
| 98 | <div class="flex items-center gap-2 min-w-0"> |
| 99 | {{icon "tag" "size-4"}} |
| 100 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{.Name}}" class="font-mono font-semibold text-sm">{{.Name}}</a> |
| 101 | {{if .Subject}} |
| 102 | <span class="text-xs text-muted truncate">— {{.Subject}}</span> |
| 103 | {{end}} |
| 104 | </div> |
| 105 | <div class="flex items-center gap-2 flex-shrink-0"> |
| 106 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/commit/{{.Hash}}" class="badge badge-outline font-mono">{{.ShortHash}}</a> |
| 107 | <span class="text-xs text-muted">{{timeAgo .CreatedAt $.Lang}}</span> |
| 108 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/archive/{{.Name}}.zip" class="btn btn-ghost btn-icon" style="width:1.65rem;height:1.65rem;" title="{{t $.Lang "repo.download_zip"}}"> |
| 109 | {{icon "download" "size-3.5"}} |
| 110 | </a> |
| 111 | {{if $.CanWrite}} |
| 112 | <form method="post" action="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tags/delete" style="margin:0;"> |
| 113 | <input type="hidden" name="_csrf" value="{{$.CSRFToken}}"> |
| 114 | <input type="hidden" name="tag_name" value="{{.Name}}"> |
| 115 | <button type="submit" class="btn btn-ghost btn-icon text-destructive" style="width:1.65rem;height:1.65rem;" title="{{t $.Lang "common.delete"}}"> |
| 116 | {{icon "trash" "size-3.5"}} |
| 117 | </button> |
| 118 | </form> |
| 119 | {{end}} |
| 120 | </div> |
| 121 | </div> |
| 122 | {{end}} |
| 123 | </div> |
| 124 | {{else}} |
| 125 | <div class="card-body text-xs text-muted">{{t .Lang "repo.tags.empty"}}</div> |
| 126 | {{end}} |
| 127 | </section> |
| 128 | </div> |
| 129 | {{end}} |