106 lines
4.9 kB
1
{{ define "title" }}Commits · {{ .RepoInfo.FullName }}{{ end }}
2
3
{{ define "repoContent" }}
4
5
<h1>Commits</h1>
6
<main>
7
<div id="commit-log" class="flex-1">
8
{{ range .Commits }}
9
<div class="flex flex-row justify-between items-center">
10
<i
11
class="w-5 h-5 mt-5 text-gray-400 align-middle"
12
data-lucide="git-commit-horizontal"
13
></i>
14
<div
15
class="relative w-full px-4 py-4 mt-5 mx-3 hover:bg-gray-50 border border-gray-200"
16
>
17
<div id="commit-message">
18
{{ $messageParts := splitN .Message "\n\n" 2 }}
19
<div class="text-base cursor-pointer">
20
<div>
21
<div>
22
<a
23
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
24
class="inline no-underline hover:underline"
25
>{{ index $messageParts 0 }}</a
26
>
27
{{ if gt (len $messageParts) 1 }}
28
29
<button
30
class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded"
31
hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
32
>
33
<i
34
class="w-3 h-3"
35
data-lucide="ellipsis"
36
></i>
37
</button>
38
{{ end }}
39
</div>
40
{{ if gt (len $messageParts) 1 }}
41
<p
42
class="hidden mt-1 text-sm cursor-text pb-2"
43
>
44
{{ nl2br (unwrapText (index $messageParts 1)) }}
45
</p>
46
{{ end }}
47
</div>
48
</div>
49
</div>
50
51
<div class="text-xs text-gray-500">
52
<span class="font-mono">
53
<a
54
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
55
class="text-gray-500 no-underline hover:underline"
56
>{{ slice .Hash.String 0 8 }}</a
57
>
58
</span>
59
<span
60
class="mx-2 before:content-['·'] before:select-none"
61
></span>
62
<span>
63
<a
64
href="mailto:{{ .Author.Email }}"
65
class="text-gray-500 no-underline hover:underline"
66
>{{ .Author.Name }}</a
67
>
68
</span>
69
<div
70
class="inline-block px-1 select-none after:content-['·']"
71
></div>
72
<span>{{ timeFmt .Author.When }}</span>
73
</div>
74
</div>
75
</div>
76
{{ end }}
77
</div>
78
79
{{ $commits_len := len .Commits }}
80
<div class="flex justify-between mt-4 px-10">
81
{{ if gt .Page 1 }}
82
<a
83
class="btn flex items-center gap-2 no-underline"
84
hx-boost="true"
85
onclick="window.location.href = window.location.pathname + '?page={{ sub .Page 1 }}'"
86
>
87
<i data-lucide="chevron-left" class="w-4 h-4"></i>
88
previous
89
</a>
90
{{ else }}
91
<div></div>
92
{{ end }}
93
94
{{ if eq $commits_len 30 }}
95
<a
96
class="btn flex items-center gap-2 no-underline"
97
hx-boost="true"
98
onclick="window.location.href = window.location.pathname + '?page={{ add .Page 1 }}'"
99
>
100
next
101
<i data-lucide="chevron-right" class="w-4 h-4"></i>
102
</a>
103
{{ end }}
104
</div>
105
</main>
106
{{ end }}
107