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