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