rin
Публичный Open-source lightweight git hosting.
repo.html · 205 строк · 10.6 KB
Raw
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 <div class="repo-layout">
40 <div class="repo-main">
41 <!-- Controls Bar: Branch/Tag Switcher + Breadcrumb + File Filter -->
42 <div class="flex items-center justify-between flex-wrap gap-2 mb-3">
43 <div class="flex items-center gap-2 flex-wrap">
44 <div class="dropdown" data-dropdown>
45 <button type="button" class="btn btn-outline btn-sm font-mono" data-dropdown-trigger aria-haspopup="true" aria-expanded="false">
46 {{icon "git-branch" "size-3.5"}}
47 <span>{{.Ref}}</span>
48 {{icon "chevron-down" "size-3.5"}}
49 </button>
50 <div class="dropdown-menu" data-dropdown-menu role="menu" style="min-width:13rem;">
51 <div class="palette-group-title">{{t .Lang "repo.branches"}} ({{len .Branches}})</div>
52 {{range .Branches}}
53 <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{.}}{{if $.SubPath}}/{{$.SubPath}}{{end}}" class="dropdown-item font-mono {{if eq . $.Ref}}active{{end}}" role="menuitem">
54 <span class="flex items-center gap-2">{{icon "git-branch" "size-3.5"}} {{.}}</span>
55 {{if eq . $.Ref}}{{icon "check" "size-3.5"}}{{end}}
56 </a>
57 {{end}}
58 {{if .Tags}}
59 <hr class="separator" style="margin:0.25rem 0;">
60 <div class="palette-group-title">{{t .Lang "repo.tags"}} ({{len .Tags}})</div>
61 {{range .Tags}}
62 <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{.}}{{if $.SubPath}}/{{$.SubPath}}{{end}}" class="dropdown-item font-mono {{if eq . $.Ref}}active{{end}}" role="menuitem">
63 <span class="flex items-center gap-2">{{icon "tag" "size-3.5"}} {{.}}</span>
64 {{if eq . $.Ref}}{{icon "check" "size-3.5"}}{{end}}
65 </a>
66 {{end}}
67 {{end}}
68 </div>
69 </div>
70
71 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/branches" class="btn btn-ghost btn-sm font-mono" title="{{t .Lang "repo.tab.branches"}}">
72 {{icon "git-branch" "size-3.5"}}
73 <span class="text-xs">{{len .Branches}}</span>
74 </a>
75 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/commits/{{.Ref}}" class="btn btn-ghost btn-sm font-mono" title="{{t .Lang "repo.tab.commits"}}">
76 {{icon "history" "size-3.5"}}
77 <span class="text-xs">{{t .Lang "repo.tab.commits"}}</span>
78 </a>
79
80 {{if .Breadcrumbs}}
81 <nav class="breadcrumb font-mono text-xs" aria-label="Directory path">
82 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/tree/{{.Ref}}" class="text-muted">{{.Repo.Name}}</a>
83 {{range .Breadcrumbs}}
84 <span class="breadcrumb-sep">/</span>
85 {{if .IsLast}}
86 <span class="font-semibold">{{.Name}}</span>
87 {{else}}
88 <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{$.Ref}}/{{.Path}}" class="text-muted">{{.Name}}</a>
89 {{end}}
90 {{end}}
91 </nav>
92 {{end}}
93 </div>
94
95 <div class="flex items-center gap-2 flex-wrap">
96 <div class="flex items-center" style="position:relative;">
97 <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>
98 <kbd class="kbd" style="position:absolute;right:0.35rem;pointer-events:none;">t</kbd>
99 </div>
100 {{if .CanWrite}}
101 <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"}}">
102 {{icon "plus" "size-3.5"}}
103 <span class="hidden md-flex">{{t .Lang "file.new_file"}}</span>
104 </a>
105 <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"}}">
106 {{icon "folder" "size-3.5"}}
107 <span class="hidden md-flex">{{t .Lang "file.new_folder"}}</span>
108 </a>
109 {{end}}
110 </div>
111 </div>
112
113 <!-- Unified Repository Card: Latest Commit Header + File List -->
114 <div class="card mb-4">
115 {{if .LatestCommit}}
116 <div class="card-header text-xs" style="padding:0.5rem 0.8rem;background:hsl(var(--muted)/0.3);">
117 <div class="flex items-center gap-2 min-w-0">
118 <span class="avatar" style="width:1.25rem;height:1.25rem;font-size:0.62rem;">{{avatarInitial .LatestCommit.AuthorName}}</span>
119 <span class="font-medium">{{.LatestCommit.AuthorName}}</span>
120 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/commit/{{.LatestCommit.Hash}}" class="text-muted truncate">{{.LatestCommit.Subject}}</a>
121 </div>
122 <div class="flex items-center gap-2 text-muted font-mono">
123 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/commit/{{.LatestCommit.Hash}}" class="badge badge-outline font-mono">{{.LatestCommit.ShortHash}}</a>
124 <span>{{timeAgo .LatestCommit.AuthoredAt .Lang}}</span>
125 </div>
126 </div>
127 {{end}}
128
129 <div class="dense-list">
130 {{if .SubPath}}
131 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/tree/{{.Ref}}{{if ne .ParentPath "."}}/{{.ParentPath}}{{end}}" class="dense-row font-mono text-xs text-muted">
132 <span class="flex items-center gap-2">{{icon "arrow-left" "size-3.5"}} ..</span>
133 </a>
134 {{end}}
135 {{range .Entries}}
136 <div class="dense-row" data-tree-row data-tree-name="{{.Name}}">
137 <div class="flex items-center gap-2 min-w-0" style="flex:1 1 40%;">
138 {{if eq .Type "tree"}}
139 {{icon "folder" "size-4"}}
140 <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/tree/{{$.Ref}}/{{.Path}}" class="font-medium truncate">{{.Name}}</a>
141 {{else}}
142 {{icon "file" "size-4"}}
143 <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/blob/{{$.Ref}}/{{.Path}}" class="truncate">{{.Name}}</a>
144 {{end}}
145 </div>
146 <div class="hidden md-flex text-xs text-muted truncate" style="flex:1 1 45%;">
147 {{if .CommitHash}}
148 <a href="/{{$.Repo.OwnerUsername}}/{{$.Repo.Name}}/commit/{{.CommitHash}}" class="truncate text-muted">{{.CommitMsg}}</a>
149 {{end}}
150 </div>
151 <div class="text-xs text-muted font-mono" style="text-align:right;min-width:5rem;">
152 {{if not .CommitTime.IsZero}}
153 {{timeAgo .CommitTime $.Lang}}
154 {{else if eq .Type "blob"}}
155 {{formatSize .Size}}
156 {{end}}
157 </div>
158 </div>
159 {{end}}
160 </div>
161 </div>
162
163 {{if .ReadmeHTML}}
164 <section class="card">
165 <div class="card-header" style="padding:0.55rem 0.85rem;">
166 <span class="font-semibold text-xs flex items-center gap-2 font-mono">
167 {{icon "book-open" "size-3.5"}}
168 <span>{{.ReadmeName}}</span>
169 </span>
170 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/blob/{{.Ref}}/{{.ReadmeName}}" class="text-xs text-muted">{{t .Lang "repo.view_file"}}</a>
171 </div>
172 <div class="card-body markdown-body">
173 {{.ReadmeHTML}}
174 </div>
175 </section>
176 {{end}}
177 </div>
178
179 <aside class="repo-side">
180 <div class="side-card">
181 <div class="side-card-header">{{icon "terminal" "size-3.5"}} {{t .Lang "repo.clone_title"}}</div>
182 <div class="side-card-body">
183 <div class="clone-box">
184 <code>{{.CloneURL}}</code>
185 <button type="button" class="btn btn-ghost btn-icon" style="width:1.6rem;height:1.6rem;" data-copy="{{.CloneURL}}" title="{{t .Lang "common.copy"}}">
186 {{icon "copy" "size-3.5"}}
187 </button>
188 </div>
189 <div class="flex items-center justify-between">
190 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/archive/{{.Ref}}.zip" class="text-xs text-muted flex items-center gap-1.5">
191 {{icon "download" "size-3.5"}}
192 <span>{{t .Lang "repo.download_zip"}}</span>
193 </a>
194 <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/commits/{{.Ref}}" class="text-xs text-muted flex items-center gap-1.5">
195 {{icon "history" "size-3.5"}}
196 <span>{{t .Lang "repo.tab.commits"}}</span>
197 </a>
198 </div>
199 </div>
200 </div>
201 </aside>
202 </div>
203 {{end}}
204 </div>
205 {{end}}