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