···
{{ define "repoContent" }}
5
-
<div class="flex justify-between pb-5">
7
-
onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + this.value"
8
-
class="p-1 border border-gray-200 bg-white"
10
-
<optgroup label="branches" class="bold text-sm">
11
-
{{ range .Branches }}
13
-
value="{{ .Reference.Name }}"
15
-
{{ if eq .Reference.Name $.Ref }}
19
-
{{ .Reference.Name }}
23
-
<optgroup label="tags" class="bold text-sm">
26
-
value="{{ .Reference.Name }}"
28
-
{{ if eq .Reference.Name $.Ref }}
32
-
{{ .Reference.Name }}
35
-
<option class="py-1" disabled>no tags found</option>
40
-
href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref }}"
41
-
class="ml-2 no-underline flex items-center gap-2 text-sm uppercase font-bold"
43
-
<i class="w-4 h-4" data-lucide="logs"></i>
45
-
{{ if eq .TotalCommits 1 }}commit{{ else }}commits{{ end }}
5
+
{{ block "branchSelector" . }} {{ end }}
6
+
<div class="flex gap-2">
7
+
{{ block "fileTree" . }} {{ end }}
8
+
{{ block "commitLog" . }} {{ end }}
49
-
<div class="flex gap-2">
50
-
<div id="file-tree" class="w-3/5 pr-2 border-r border-gray-200">
51
-
{{ $containerstyle := "py-1" }}
52
-
{{ $linkstyle := "no-underline hover:underline" }}
13
+
{{ define "branchSelector" }}
14
+
<div class="flex justify-between pb-5">
16
+
onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + this.value"
17
+
class="p-1 border border-gray-200 bg-white"
19
+
<optgroup label="branches" class="bold text-sm">
20
+
{{ range .Branches }}
22
+
value="{{ .Reference.Name }}"
24
+
{{ if eq .Reference.Name $.Ref }}
28
+
{{ .Reference.Name }}
32
+
<optgroup label="tags" class="bold text-sm">
35
+
value="{{ .Reference.Name }}"
37
+
{{ if eq .Reference.Name $.Ref }}
41
+
{{ .Reference.Name }}
44
+
<option class="py-1" disabled>no tags found</option>
49
+
href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref }}"
50
+
class="ml-2 no-underline flex items-center gap-2 text-sm uppercase font-bold"
52
+
<i class="w-4 h-4" data-lucide="logs"></i>
54
+
{{ if eq .TotalCommits 1 }}commit{{ else }}commits{{ end }}
55
-
{{ if not .IsFile }}
56
-
<div class="{{ $containerstyle }}">
57
-
<div class="flex justify-between items-center">
59
-
href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref }}/{{ .Name }}"
60
-
class="{{ $linkstyle }}"
62
-
<div class="flex items-center gap-2">
64
-
class="w-3 h-3 fill-current"
65
-
data-lucide="folder"
59
+
{{ define "fileTree" }}
60
+
<div id="file-tree" class="w-3/5 pr-2 border-r border-gray-200">
61
+
{{ $containerstyle := "py-1" }}
62
+
{{ $linkstyle := "no-underline hover:underline" }}
71
-
<time class="text-xs text-gray-500"
72
-
>{{ timeFmt .LastCommit.Author.When }}</time
65
+
{{ if not .IsFile }}
66
+
<div class="{{ $containerstyle }}">
67
+
<div class="flex justify-between items-center">
69
+
href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref }}/{{ .Name }}"
70
+
class="{{ $linkstyle }}"
72
+
<div class="flex items-center gap-2">
74
+
class="w-3 h-3 fill-current"
75
+
data-lucide="folder"
81
-
<div class="{{ $containerstyle }}">
82
-
<div class="flex justify-between items-center">
84
-
href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref }}/{{ .Name }}"
85
-
class="{{ $linkstyle }}"
87
-
<div class="flex items-center gap-2">
81
+
<time class="text-xs text-gray-500"
82
+
>{{ timeFmt .LastCommit.Author.When }}</time
96
-
<time class="text-xs text-gray-500"
97
-
>{{ timeFmt .LastCommit.Author.When }}</time
91
+
<div class="{{ $containerstyle }}">
92
+
<div class="flex justify-between items-center">
94
+
href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref }}/{{ .Name }}"
95
+
class="{{ $linkstyle }}"
97
+
<div class="flex items-center gap-2">
106
+
<time class="text-xs text-gray-500"
107
+
>{{ timeFmt .LastCommit.Author.When }}</time
105
-
<div id="commit-log" class="flex-1">
106
-
{{ range .Commits }}
107
-
<div class="relative px-2 pb-8">
108
-
<div id="commit-message">
109
-
{{ $messageParts := splitN .Message "\n\n" 2 }}
110
-
<div class="text-base cursor-pointer">
114
-
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
115
-
class="inline no-underline hover:underline"
116
-
>{{ index $messageParts 0 }}</a
118
-
{{ if gt (len $messageParts) 1 }}
121
-
class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded"
122
-
hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
126
-
data-lucide="ellipsis"
131
-
{{ if gt (len $messageParts) 1 }}
133
-
class="hidden mt-1 text-sm cursor-text pb-2"
135
-
{{ nl2br (unwrapText (index $messageParts 1)) }}
117
+
{{ define "commitLog" }}
118
+
<div id="commit-log" class="flex-1">
119
+
{{ range .Commits }}
120
+
<div class="relative px-2 pb-8">
121
+
<div id="commit-message">
122
+
{{ $messageParts := splitN .Message "\n\n" 2 }}
123
+
<div class="text-base cursor-pointer">
127
+
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
128
+
class="inline no-underline hover:underline"
129
+
>{{ index $messageParts 0 }}</a
131
+
{{ if gt (len $messageParts) 1 }}
142
-
<div class="text-xs text-gray-500">
143
-
<span class="font-mono">
145
-
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
146
-
class="text-gray-500 no-underline hover:underline"
147
-
>{{ slice .Hash.String 0 8 }}</a
151
-
class="mx-2 before:content-['·'] before:select-none"
155
-
href="mailto:{{ .Author.Email }}"
156
-
class="text-gray-500 no-underline hover:underline"
157
-
>{{ .Author.Name }}</a
134
+
class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded"
135
+
hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
161
-
class="inline-block px-1 select-none after:content-['·']"
163
-
<span>{{ timeFmt .Author.When }}</span>
139
+
data-lucide="ellipsis"
144
+
{{ $tagsForCommit := index $.TagMap .Hash.String }}
145
+
{{ range $tagsForCommit }}
146
+
<span class="text-xs rounded-full bg-black text-white px-2 mx-1 inline-flex items-center">
151
+
{{ if gt (len $messageParts) 1 }}
153
+
class="hidden mt-1 text-sm cursor-text pb-2"
155
+
{{ nl2br (unwrapText (index $messageParts 1)) }}
162
+
<div class="text-xs text-gray-500">
163
+
<span class="font-mono">
165
+
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
166
+
class="text-gray-500 no-underline hover:underline"
167
+
>{{ slice .Hash.String 0 8 }}</a
171
+
class="mx-2 before:content-['·'] before:select-none"
175
+
href="mailto:{{ .Author.Email }}"
176
+
class="text-gray-500 no-underline hover:underline"
177
+
>{{ .Author.Name }}</a
181
+
class="inline-block px-1 select-none after:content-['·']"
183
+
<span>{{ timeFmt .Author.When }}</span>