rin
Публичный Open-source lightweight git hosting.
profile.html · 138 строк · 6.1 KB
Raw
1 {{define "content"}}
2 <div class="container">
3 <!-- Profile Card -->
4 <div class="card p-4 mb-4">
5 <div class="flex items-start justify-between flex-wrap gap-4">
6 <div class="flex items-start gap-4 min-w-0">
7 {{avatar .ProfileUser.Username .ProfileUser.AvatarURL "avatar-xl"}}
8 <div class="flex flex-col gap-1 min-w-0">
9 <div class="flex items-center gap-2 flex-wrap">
10 {{if .ProfileUser.FullName}}
11 <h1 class="text-xl font-bold" style="margin:0;line-height:1.2;">{{.ProfileUser.FullName}}</h1>
12 <span class="font-mono text-sm text-muted">@{{.ProfileUser.Username}}</span>
13 {{else}}
14 <h1 class="text-xl font-bold" style="margin:0;line-height:1.2;">{{.ProfileUser.Username}}</h1>
15 {{end}}
16 {{if .ProfileUser.IsAdmin}}
17 <span class="badge badge-primary">{{t .Lang "admin.role.admin"}}</span>
18 {{end}}
19 </div>
20
21 {{if .ProfileUser.Bio}}
22 <p class="text-sm" style="margin:0.15rem 0 0.25rem;max-width:38rem;">{{.ProfileUser.Bio}}</p>
23 {{end}}
24
25 <div class="flex items-center flex-wrap gap-3 text-xs text-muted mt-1">
26 {{if .ProfileUser.Location}}
27 <span class="flex items-center gap-1">
28 {{icon "map-pin" "size-3.5"}}
29 <span>{{.ProfileUser.Location}}</span>
30 </span>
31 {{end}}
32 {{if .ProfileUser.Website}}
33 <a href="{{.ProfileUser.Website}}" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1" style="color:hsl(var(--foreground));text-decoration:underline;text-underline-offset:3px;">
34 {{icon "link" "size-3.5"}}
35 <span>{{.ProfileUser.Website}}</span>
36 </a>
37 {{end}}
38 <span class="flex items-center gap-1">
39 {{icon "calendar" "size-3.5"}}
40 <span>{{t .Lang "profile.joined"}}: {{formatShortDate .ProfileUser.CreatedAt}}</span>
41 </span>
42 </div>
43 </div>
44 </div>
45
46 <div class="flex items-center gap-2">
47 {{if .CurrentUser}}
48 {{if eq .CurrentUser.ID .ProfileUser.ID}}
49 <a href="/settings" class="btn btn-outline btn-sm">
50 {{icon "edit" "size-3.5"}}
51 <span>{{t .Lang "profile.edit"}}</span>
52 </a>
53 {{end}}
54 {{end}}
55 </div>
56 </div>
57
58 <!-- Stats Row -->
59 <div class="flex items-center gap-4 flex-wrap mt-4 pt-3" style="border-top:1px solid hsl(var(--border));">
60 <div class="flex items-center gap-1.5 text-xs">
61 {{icon "git-branch" "size-3.5"}}
62 <span class="text-muted">{{t .Lang "profile.total_repos"}}:</span>
63 <strong class="font-mono">{{len .Repos}}</strong>
64 </div>
65 <div class="flex items-center gap-1.5 text-xs">
66 {{icon "globe" "size-3.5"}}
67 <span class="text-muted">{{t .Lang "profile.public_repos"}}:</span>
68 <strong class="font-mono">{{.PublicRepoCount}}</strong>
69 </div>
70 {{if .ShowPrivateCount}}
71 <div class="flex items-center gap-1.5 text-xs">
72 {{icon "lock" "size-3.5"}}
73 <span class="text-muted">{{t .Lang "profile.private_repos"}}:</span>
74 <strong class="font-mono">{{.PrivateRepoCount}}</strong>
75 </div>
76 {{end}}
77 </div>
78 </div>
79
80 <!-- Repositories Section -->
81 <div class="flex items-center justify-between flex-wrap gap-3 mb-3">
82 <h2 class="text-base font-semibold" style="margin:0;">{{t .Lang "nav.repositories"}} ({{len .Repos}})</h2>
83 <div class="flex items-center gap-2">
84 <div class="flex items-center" style="position:relative;">
85 <input type="text" class="input" style="height:1.85rem;width:14rem;padding-right:1.8rem;" placeholder="{{t .Lang "repo.filter_ph"}}" data-search-input data-file-filter>
86 <kbd class="kbd" style="position:absolute;right:0.4rem;pointer-events:none;">/</kbd>
87 </div>
88 {{if .CurrentUser}}
89 {{if eq .CurrentUser.ID .ProfileUser.ID}}
90 <a href="/new" class="btn btn-primary btn-sm" style="height:1.85rem;">
91 {{icon "plus" "size-3.5"}}
92 <span>{{t .Lang "nav.new_repo"}}</span>
93 </a>
94 {{end}}
95 {{end}}
96 </div>
97 </div>
98
99 {{if .Repos}}
100 <div class="grid-2">
101 {{range .Repos}}
102 <div class="card p-3 flex flex-col justify-between gap-2" data-tree-row data-tree-name="{{.Name}} {{.Description}}">
103 <div>
104 <div class="flex items-center justify-between gap-2 mb-1">
105 <a href="/{{.OwnerUsername}}/{{.Name}}" class="font-semibold text-sm flex items-center gap-1.5 truncate">
106 {{if .IsPrivate}}
107 {{icon "lock" "size-3.5"}}
108 {{else}}
109 {{icon "git-branch" "size-3.5"}}
110 {{end}}
111 <span class="truncate">{{.Name}}</span>
112 </a>
113 {{if .IsPrivate}}
114 <span class="badge badge-outline">{{t $.Lang "repo.private"}}</span>
115 {{else}}
116 <span class="badge badge-outline">{{t $.Lang "repo.public"}}</span>
117 {{end}}
118 </div>
119 {{if .Description}}
120 <p class="text-xs text-muted" style="margin:0.2rem 0 0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;">{{.Description}}</p>
121 {{end}}
122 </div>
123 <div class="flex items-center justify-between text-xs text-muted pt-2" style="border-top:1px solid hsl(var(--border)/0.6);">
124 <span class="font-mono flex items-center gap-1">{{icon "git-branch" "size-3.5"}} {{.DefaultBranch}}</span>
125 <span>{{timeAgo .UpdatedAt $.Lang}}</span>
126 </div>
127 </div>
128 {{end}}
129 </div>
130 {{else}}
131 {{if and .CurrentUser (eq .CurrentUser.ID .ProfileUser.ID)}}
132 {{template "ui_empty_state" (dict "Icon" "git-branch" "Title" (t .Lang "repo.empty_list") "Subtitle" (t .Lang "repo.empty_list_sub") "ActionHref" "/new" "ActionLabel" (t .Lang "repo.new.title") "ActionIcon" "plus")}}
133 {{else}}
134 {{template "ui_empty_state" (dict "Icon" "git-branch" "Title" (t .Lang "repo.empty_list"))}}
135 {{end}}
136 {{end}}
137 </div>
138 {{end}}