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