repo.html
·
200 lines
·
10.3 KB
| 1 | {{define "content"}} |
| 2 | <div class="container"> |
| 3 | {{template "repo_header" .}} |
| 4 | |
| 5 | {{if .IsEmpty}} |
| 6 | <div class="card"> |
| 7 | <div class="card-header"> |
| 8 | <span class="font-semibold flex items-center gap-2">{{icon "terminal" "size-4"}} {{t .Lang "repo.empty.title"}}</span> |
| 9 | <a href="/settings#tokens" class="btn btn-outline btn-sm"> |
| 10 | {{icon "key" "size-3.5"}} |
| 11 | <span>{{t .Lang "settings.tokens"}}</span> |
| 12 | </a> |
| 13 | </div> |
| 14 | <div class="card-body flex flex-col gap-4"> |
| 15 | <div> |
| 16 | <div class="flex items-center justify-between mb-1.5"> |
| 17 | <span class="text-xs font-semibold">1. {{t .Lang "repo.empty.new_cmd"}}</span> |
| 18 | <button type="button" class="btn btn-ghost btn-sm" data-copy="{{.QuickStartNew}}"> |
| 19 | {{icon "copy" "size-3.5"}} |
| 20 | <span>{{t .Lang "common.copy"}}</span> |
| 21 | </button> |
| 22 | </div> |
| 23 | <pre class="card p-3 font-mono text-xs" style="margin:0;background:hsl(var(--muted)/0.4);overflow-x:auto;"><code>{{.QuickStartNew}}</code></pre> |
| 24 | </div> |
| 25 | |
| 26 | <div> |
| 27 | <div class="flex items-center justify-between mb-1.5"> |
| 28 | <span class="text-xs font-semibold">2. {{t .Lang "repo.empty.push_cmd"}}</span> |
| 29 | <button type="button" class="btn btn-ghost btn-sm" data-copy="{{.QuickStartExisting}}"> |
| 30 | {{icon "copy" "size-3.5"}} |
| 31 | <span>{{t .Lang "common.copy"}}</span> |
| 32 | </button> |
| 33 | </div> |
| 34 | <pre class="card p-3 font-mono text-xs" style="margin:0;background:hsl(var(--muted)/0.4);overflow-x:auto;"><code>{{.QuickStartExisting}}</code></pre> |
| 35 | </div> |
| 36 | </div> |
| 37 | </div> |
| 38 | {{else}} |
| 39 | <!-- Controls Bar: Branch/Tag Switcher + Breadcrumb + File Filter --> |
| 40 | <div class="flex items-center justify-between flex-wrap gap-2 mb-3"> |
| 41 | <div class="flex items-center gap-2 flex-wrap"> |
| 42 | <div class="dropdown" data-dropdown> |
| 43 | <button type="button" class="btn btn-outline btn-sm font-mono" data-dropdown-trigger aria-haspopup="true" aria-expanded="false"> |
| 44 | {{icon "git-branch" "size-3.5"}} |
| 45 | <span>{{.Ref}}</span> |
| 46 | {{icon "chevron-down" "size-3.5"}} |
| 47 | </button> |
| 48 | <div class="dropdown-menu" data-dropdown-menu role="menu" style="min-width:13rem;"> |
| 49 | <div class="palette-group-title">{{t .Lang "repo.branches"}} ({{len .Branches}})</div> |
| 50 | {{range .Branches}} |
| 51 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{.}}{{if $.SubPath}}/{{$.SubPath}}{{end}}" class="dropdown-item font-mono {{if eq . $.Ref}}active{{end}}" role="menuitem"> |
| 52 | <span class="flex items-center gap-2">{{icon "git-branch" "size-3.5"}} {{.}}</span> |
| 53 | {{if eq . $.Ref}}{{icon "check" "size-3.5"}}{{end}} |
| 54 | </a> |
| 55 | {{end}} |
| 56 | {{if .Tags}} |
| 57 | <hr class="separator" style="margin:0.25rem 0;"> |
| 58 | <div class="palette-group-title">{{t .Lang "repo.tags"}} ({{len .Tags}})</div> |
| 59 | {{range .Tags}} |
| 60 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{.}}{{if $.SubPath}}/{{$.SubPath}}{{end}}" class="dropdown-item font-mono {{if eq . $.Ref}}active{{end}}" role="menuitem"> |
| 61 | <span class="flex items-center gap-2">{{icon "tag" "size-3.5"}} {{.}}</span> |
| 62 | {{if eq . $.Ref}}{{icon "check" "size-3.5"}}{{end}} |
| 63 | </a> |
| 64 | {{end}} |
| 65 | {{end}} |
| 66 | </div> |
| 67 | </div> |
| 68 | |
| 69 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/branches" class="btn btn-ghost btn-sm font-mono" title="{{t .Lang "repo.tab.branches"}}"> |
| 70 | {{icon "git-branch" "size-3.5"}} |
| 71 | <span class="text-xs">{{len .Branches}}</span> |
| 72 | </a> |
| 73 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/commits/{{.Ref}}" class="btn btn-ghost btn-sm font-mono" title="{{t .Lang "repo.tab.commits"}}"> |
| 74 | {{icon "history" "size-3.5"}} |
| 75 | <span class="text-xs">{{t .Lang "repo.tab.commits"}}</span> |
| 76 | </a> |
| 77 | |
| 78 | {{if .Breadcrumbs}} |
| 79 | <nav class="breadcrumb font-mono text-xs" aria-label="Directory path"> |
| 80 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/tree/{{.Ref}}" class="text-muted">{{.Repo.Name}}</a> |
| 81 | {{range .Breadcrumbs}} |
| 82 | <span class="breadcrumb-sep">/</span> |
| 83 | {{if .IsLast}} |
| 84 | <span class="font-semibold">{{.Name}}</span> |
| 85 | {{else}} |
| 86 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{$.Ref}}/{{.Path}}" class="text-muted">{{.Name}}</a> |
| 87 | {{end}} |
| 88 | {{end}} |
| 89 | </nav> |
| 90 | {{end}} |
| 91 | </div> |
| 92 | |
| 93 | <div class="flex items-center gap-2 flex-wrap"> |
| 94 | <div class="flex items-center" style="position:relative;"> |
| 95 | <input type="text" class="input" style="height:1.75rem;width:13rem;padding-right:1.75rem;font-size:0.78rem;" placeholder="{{t .Lang "repo.find_file"}}" data-file-filter> |
| 96 | <kbd class="kbd" style="position:absolute;right:0.35rem;pointer-events:none;">t</kbd> |
| 97 | </div> |
| 98 | |
| 99 | <div class="dropdown" data-dropdown> |
| 100 | <button type="button" class="btn btn-outline btn-sm" data-dropdown-trigger aria-haspopup="true" aria-expanded="false" title="{{t .Lang "repo.clone_title"}}"> |
| 101 | {{icon "terminal" "size-3.5"}} |
| 102 | <span class="hidden md-flex">{{t .Lang "repo.clone_title"}}</span> |
| 103 | </button> |
| 104 | <div class="dropdown-menu" data-dropdown-menu role="menu" style="min-width:22rem;padding:0.65rem;"> |
| 105 | <div class="clone-box"> |
| 106 | <code>{{.CloneURL}}</code> |
| 107 | <button type="button" class="btn btn-ghost btn-icon" style="width:1.6rem;height:1.6rem;flex:none;" data-copy="{{.CloneURL}}" title="{{t .Lang "common.copy"}}"> |
| 108 | {{icon "copy" "size-3.5"}} |
| 109 | </button> |
| 110 | </div> |
| 111 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/archive/{{.Ref}}.zip" class="dropdown-item" role="menuitem" style="margin-top:0.35rem;"> |
| 112 | <span class="flex items-center gap-2">{{icon "download" "size-3.5"}} <span>{{t .Lang "repo.download_zip"}}</span></span> |
| 113 | </a> |
| 114 | </div> |
| 115 | </div> |
| 116 | |
| 117 | {{if .CanWrite}} |
| 118 | <a class="btn btn-outline btn-sm" href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/new-file?ref={{.Ref}}{{if .SubPath}}&path={{.SubPath}}{{end}}" title="{{t .Lang "file.new_file"}}"> |
| 119 | {{icon "plus" "size-3.5"}} |
| 120 | <span class="hidden md-flex">{{t .Lang "file.new_file"}}</span> |
| 121 | </a> |
| 122 | <a class="btn btn-ghost btn-sm" href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/new-folder?ref={{.Ref}}{{if .SubPath}}&path={{.SubPath}}{{end}}" title="{{t .Lang "file.new_folder"}}"> |
| 123 | {{icon "folder" "size-3.5"}} |
| 124 | <span class="hidden md-flex">{{t .Lang "file.new_folder"}}</span> |
| 125 | </a> |
| 126 | <a class="btn btn-ghost btn-sm" href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/upload?ref={{.Ref}}{{if .SubPath}}&path={{.SubPath}}{{end}}" title="{{t .Lang "file.upload_file"}}"> |
| 127 | {{icon "upload" "size-3.5"}} |
| 128 | <span class="hidden md-flex">{{t .Lang "file.upload_file"}}</span> |
| 129 | </a> |
| 130 | {{end}} |
| 131 | </div> |
| 132 | </div> |
| 133 | |
| 134 | <!-- Unified Repository Card: Latest Commit Header + File List --> |
| 135 | <div class="card mb-4"> |
| 136 | {{if .LatestCommit}} |
| 137 | <div class="card-header text-xs" style="padding:0.5rem 0.8rem;background:hsl(var(--muted)/0.3);"> |
| 138 | <div class="flex items-center gap-2 min-w-0"> |
| 139 | <span class="avatar" style="width:1.25rem;height:1.25rem;font-size:0.62rem;">{{avatarInitial .LatestCommit.AuthorName}}</span> |
| 140 | <span class="font-medium">{{.LatestCommit.AuthorName}}</span> |
| 141 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/commit/{{.LatestCommit.Hash}}" class="text-muted truncate">{{.LatestCommit.Subject}}</a> |
| 142 | </div> |
| 143 | <div class="flex items-center gap-2 text-muted font-mono"> |
| 144 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/commit/{{.LatestCommit.Hash}}" class="badge badge-outline font-mono">{{.LatestCommit.ShortHash}}</a> |
| 145 | <span>{{timeAgo .LatestCommit.AuthoredAt .Lang}}</span> |
| 146 | </div> |
| 147 | </div> |
| 148 | {{end}} |
| 149 | |
| 150 | <div class="dense-list"> |
| 151 | {{if .SubPath}} |
| 152 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/tree/{{.Ref}}{{if ne .ParentPath "."}}/{{.ParentPath}}{{end}}" class="dense-row font-mono text-xs text-muted"> |
| 153 | <span class="flex items-center gap-2">{{icon "arrow-left" "size-3.5"}} ..</span> |
| 154 | </a> |
| 155 | {{end}} |
| 156 | {{range .Entries}} |
| 157 | <div class="dense-row" data-tree-row data-tree-name="{{.Name}}"> |
| 158 | <div class="flex items-center gap-2 min-w-0" style="flex:1 1 40%;"> |
| 159 | {{if eq .Type "tree"}} |
| 160 | {{icon "folder" "size-4"}} |
| 161 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{$.Ref}}/{{.Path}}" class="font-medium truncate">{{.Name}}</a> |
| 162 | {{else}} |
| 163 | {{icon "file" "size-4"}} |
| 164 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/blob/{{$.Ref}}/{{.Path}}" class="truncate">{{.Name}}</a> |
| 165 | {{end}} |
| 166 | </div> |
| 167 | <div class="hidden md-flex text-xs text-muted truncate" style="flex:1 1 45%;"> |
| 168 | {{if .CommitHash}} |
| 169 | <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/commit/{{.CommitHash}}" class="truncate text-muted">{{.CommitMsg}}</a> |
| 170 | {{end}} |
| 171 | </div> |
| 172 | <div class="text-xs text-muted font-mono" style="text-align:right;min-width:5rem;"> |
| 173 | {{if not .CommitTime.IsZero}} |
| 174 | {{timeAgo .CommitTime $.Lang}} |
| 175 | {{else if eq .Type "blob"}} |
| 176 | {{formatSize .Size}} |
| 177 | {{end}} |
| 178 | </div> |
| 179 | </div> |
| 180 | {{end}} |
| 181 | </div> |
| 182 | </div> |
| 183 | |
| 184 | {{if .ReadmeHTML}} |
| 185 | <section class="card"> |
| 186 | <div class="card-header" style="padding:0.55rem 0.85rem;"> |
| 187 | <span class="font-semibold text-xs flex items-center gap-2 font-mono"> |
| 188 | {{icon "book-open" "size-3.5"}} |
| 189 | <span>{{.ReadmeName}}</span> |
| 190 | </span> |
| 191 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/blob/{{.Ref}}/{{.ReadmeName}}" class="text-xs text-muted">{{t .Lang "repo.view_file"}}</a> |
| 192 | </div> |
| 193 | <div class="card-body markdown-body"> |
| 194 | {{.ReadmeHTML}} |
| 195 | </div> |
| 196 | </section> |
| 197 | {{end}} |
| 198 | {{end}} |
| 199 | </div> |
| 200 | {{end}} |