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