188 lines
8.6 kB
1
{{ define "title" }}{{ .RepoInfo.FullName }} at {{ .Ref }}{{ end }}
2
3
{{ define "repoContent" }}
4
<main>
5
<div class="flex justify-between pb-5">
6
<select
7
onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + this.value"
8
class="p-1 border border-gray-200 bg-white"
9
>
10
<optgroup label="branches" class="bold text-sm">
11
{{ range .Branches }}
12
<option
13
value="{{ .Reference.Name }}"
14
class="py-1"
15
{{ if eq .Reference.Name $.Ref }}
16
selected
17
{{ end }}
18
>
19
{{ .Reference.Name }}
20
</option>
21
{{ end }}
22
</optgroup>
23
<optgroup label="tags" class="bold text-sm">
24
{{ range .Tags }}
25
<option
26
value="{{ .Reference.Name }}"
27
class="py-1"
28
{{ if eq .Reference.Name $.Ref }}
29
selected
30
{{ end }}
31
>
32
{{ .Reference.Name }}
33
</option>
34
{{ else }}
35
<option class="py-1" disabled>no tags found</option>
36
{{ end }}
37
</optgroup>
38
</select>
39
<a
40
href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref }}"
41
class="ml-2 no-underline flex items-center gap-2 text-sm uppercase font-bold"
42
>
43
<i class="w-4 h-4" data-lucide="logs"></i>
44
{{ .TotalCommits }}
45
{{ if eq .TotalCommits 1 }}commit{{ else }}commits{{ end }}
46
</a>
47
</div>
48
49
<div class="flex gap-2">
50
<div id="file-tree" class="w-3/5 pr-2 border-r border-gray-200">
51
{{ $containerstyle := "py-1" }}
52
{{ $linkstyle := "no-underline hover:underline" }}
53
54
{{ range .Files }}
55
{{ if not .IsFile }}
56
<div class="{{ $containerstyle }}">
57
<div class="flex justify-between items-center">
58
<a
59
href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref }}/{{ .Name }}"
60
class="{{ $linkstyle }}"
61
>
62
<div class="flex items-center gap-2">
63
<i
64
class="w-3 h-3 fill-current"
65
data-lucide="folder"
66
></i
67
>{{ .Name }}
68
</div>
69
</a>
70
71
<time class="text-xs text-gray-500"
72
>{{ timeFmt .LastCommit.Author.When }}</time
73
>
74
</div>
75
</div>
76
{{ end }}
77
{{ end }}
78
79
{{ range .Files }}
80
{{ if .IsFile }}
81
<div class="{{ $containerstyle }}">
82
<div class="flex justify-between items-center">
83
<a
84
href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref }}/{{ .Name }}"
85
class="{{ $linkstyle }}"
86
>
87
<div class="flex items-center gap-2">
88
<i
89
class="w-3 h-3"
90
data-lucide="file"
91
></i
92
>{{ .Name }}
93
</div>
94
</a>
95
96
<time class="text-xs text-gray-500"
97
>{{ timeFmt .LastCommit.Author.When }}</time
98
>
99
</div>
100
</div>
101
{{ end }}
102
{{ end }}
103
</div>
104
105
<div id="commit-log" class="flex-1">
106
{{ range .Commits }}
107
<div class="relative px-2 pb-8">
108
<div id="commit-message">
109
{{ $messageParts := splitN .Message "\n\n" 2 }}
110
<div class="text-base cursor-pointer">
111
<div>
112
<div>
113
<a
114
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
115
class="inline no-underline hover:underline"
116
>{{ index $messageParts 0 }}</a
117
>
118
{{ if gt (len $messageParts) 1 }}
119
120
<button
121
class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded"
122
hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
123
>
124
<i
125
class="w-3 h-3"
126
data-lucide="ellipsis"
127
></i>
128
</button>
129
{{ end }}
130
</div>
131
{{ if gt (len $messageParts) 1 }}
132
<p
133
class="hidden mt-1 text-sm cursor-text pb-2"
134
>
135
{{ nl2br (unwrapText (index $messageParts 1)) }}
136
</p>
137
{{ end }}
138
</div>
139
</div>
140
</div>
141
142
<div class="text-xs text-gray-500">
143
<span class="font-mono">
144
<a
145
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
146
class="text-gray-500 no-underline hover:underline"
147
>{{ slice .Hash.String 0 8 }}</a
148
>
149
</span>
150
<span
151
class="mx-2 before:content-['·'] before:select-none"
152
></span>
153
<span>
154
<a
155
href="mailto:{{ .Author.Email }}"
156
class="text-gray-500 no-underline hover:underline"
157
>{{ .Author.Name }}</a
158
>
159
</span>
160
<div
161
class="inline-block px-1 select-none after:content-['·']"
162
></div>
163
<span>{{ timeFmt .Author.When }}</span>
164
</div>
165
</div>
166
{{ end }}
167
</div>
168
</div>
169
</main>
170
{{ end }}
171
172
{{ define "repoAfter" }}
173
{{- if .Readme }}
174
<section class="mt-4 p-6 rounded bg-white w-full mx-auto">
175
<article class="readme">
176
{{- .Readme -}}
177
</article>
178
</section>
179
{{- end -}}
180
181
182
<section class="mt-4 p-6 rounded bg-white w-full mx-auto">
183
<strong>clone</strong>
184
<pre>
185
git clone https://tangled.sh/{{ .RepoInfo.OwnerWithAt }}/{{ .RepoInfo.Name }} </pre
186
>
187
</section>
188
{{ end }}
189