rin
Публичный Open-source lightweight git hosting.
profile.html · 113 строк · 5.0 KB
Raw
1 {{define "content"}}
2 <div class="container">
3 <!-- Profile -->
4 <section class="profile-hero mb-4">
5 <div class="profile-hero-content flex items-start flex-wrap">
6 {{avatar .ProfileUser.Username .ProfileUser.AvatarURL "avatar-xxl"}}
7 <div class="flex-1 min-w-0" style="margin-left:1.6rem;min-width:15rem;">
8 <div class="flex items-center gap-2 flex-wrap">
9 <h1 class="text-2xl font-bold" style="margin:0;line-height:1.15;">
10 {{if .ProfileUser.FullName}}{{.ProfileUser.FullName}}{{else}}{{.ProfileUser.Username}}{{end}}
11 </h1>
12 {{if .ProfileUser.IsAdmin}}
13 <span class="badge badge-primary">{{t .Lang "admin.role.admin"}}</span>
14 {{end}}
15 </div>
16 <div class="text-sm text-muted font-mono" style="margin-top:0.3rem;">@{{.ProfileUser.Username}}</div>
17
18 {{if .ProfileUser.Bio}}
19 <p class="text-sm" style="margin:0.7rem 0 0;max-width:44rem;">{{.ProfileUser.Bio}}</p>
20 {{end}}
21
22 <div class="flex items-center flex-wrap gap-2" style="margin-top:0.9rem;">
23 {{if .ProfileUser.Location}}
24 <span class="profile-chip">{{icon "map-pin" "size-3.5"}}<span>{{.ProfileUser.Location}}</span></span>
25 {{end}}
26 {{if .ProfileUser.Website}}
27 <span class="profile-chip">{{icon "link" "size-3.5"}}<a href="{{.ProfileUser.Website}}" target="_blank" rel="noopener noreferrer">{{.ProfileUser.Website}}</a></span>
28 {{end}}
29 <span class="profile-chip">{{icon "calendar" "size-3.5"}}<span>{{t .Lang "profile.joined"}} · {{formatShortDate .ProfileUser.CreatedAt}}</span></span>
30 </div>
31 </div>
32
33 <div class="flex items-center gap-2" style="margin-left:auto;">
34 {{if .CurrentUser}}
35 {{if eq .CurrentUser.ID .ProfileUser.ID}}
36 <a href="/settings" class="btn btn-outline btn-sm">
37 {{icon "edit" "size-3.5"}}
38 <span>{{t .Lang "profile.edit"}}</span>
39 </a>
40 {{end}}
41 {{end}}
42 </div>
43 </div>
44 </section>
45
46 {{if .ProfileReadmeHTML}}
47 <!-- Profile README from the <user>/<user> repository -->
48 <section class="card mb-4">
49 <div class="card-body markdown-body">
50 {{.ProfileReadmeHTML}}
51 </div>
52 </section>
53 {{end}}
54
55 <!-- Repositories -->
56 <div class="flex items-center justify-between flex-wrap gap-2 mb-3">
57 <h2 class="text-base font-semibold" style="margin:0;">
58 {{t .Lang "nav.repositories"}}
59 <span class="badge badge-outline font-mono" style="margin-left:0.35rem;">{{len .Repos}}</span>
60 </h2>
61 <div class="flex items-center gap-2">
62 <div class="flex items-center" style="position:relative;">
63 <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>
64 <kbd class="kbd" style="position:absolute;right:0.4rem;pointer-events:none;">/</kbd>
65 </div>
66 {{if .CurrentUser}}
67 {{if eq .CurrentUser.ID .ProfileUser.ID}}
68 <a href="/new" class="btn btn-primary btn-sm" style="height:1.85rem;">
69 {{icon "plus" "size-3.5"}}
70 <span>{{t .Lang "nav.new_repo"}}</span>
71 </a>
72 {{end}}
73 {{end}}
74 </div>
75 </div>
76
77 {{if .Repos}}
78 <div class="grid-2">
79 {{range .Repos}}
80 <a href="/{{.OwnerUsername}}/{{.Name}}" class="card p-3 flex flex-col gap-2 repo-card" data-tree-row data-tree-name="{{.Name}} {{.Description}}" style="text-decoration:none;color:inherit;">
81 <div class="flex items-center justify-between gap-2">
82 <span class="font-semibold text-sm flex items-center gap-2 min-w-0">
83 {{if .IsPrivate}}
84 {{icon "lock" "size-3.5"}}
85 {{else}}
86 {{icon "book-open" "size-3.5"}}
87 {{end}}
88 <span class="truncate">{{.Name}}</span>
89 </span>
90 <span class="badge badge-outline flex-shrink-0">{{if .IsPrivate}}{{t $.Lang "repo.private"}}{{else}}{{t $.Lang "repo.public"}}{{end}}</span>
91 </div>
92 {{if .Description}}
93 <p class="text-xs text-muted" style="margin:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;">{{.Description}}</p>
94 {{end}}
95 <div class="flex items-center justify-between text-xs text-muted font-mono">
96 <span class="flex items-center gap-1.5">
97 {{icon "git-branch" "size-3.5"}}
98 <span>{{.DefaultBranch}}</span>
99 </span>
100 <span>{{timeAgo .UpdatedAt $.Lang}}</span>
101 </div>
102 </a>
103 {{end}}
104 </div>
105 {{else}}
106 {{if and .CurrentUser (eq .CurrentUser.ID .ProfileUser.ID)}}
107 {{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")}}
108 {{else}}
109 {{template "ui_empty_state" (dict "Icon" "git-branch" "Title" (t .Lang "repo.empty_list"))}}
110 {{end}}
111 {{end}}
112 </div>
113 {{end}}