This repository has no description
1{{ define "title" }}Commits · {{ .RepoInfo.FullName }} · Tangled{{ end }}
2
3{{ define "extrameta" }}
4 {{ $title := printf "Commits · %s" .RepoInfo.FullName }}
5 {{ $url := printf "https://tangled.org/%s/commits" .RepoInfo.FullName }}
6
7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
8{{ end }}
9
10{{ define "repoContent" }}
11<section id="commit-table" class="overflow-x-auto">
12 <h2 class="font-bold text-sm mb-4 dark:text-white">
13 Commits
14 </h2>
15
16 <!-- desktop view (hidden on small screens) -->
17 <div class="hidden md:flex md:flex-col divide-y divide-gray-200 dark:divide-gray-700">
18 {{ $grid := "grid grid-cols-14 gap-4" }}
19 <div class="{{ $grid }}">
20 <div class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 font-bold col-span-3">Author</div>
21 <div class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 font-bold col-span-3">Commit</div>
22 <div class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 font-bold col-span-6">Message</div>
23 <div class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 font-bold col-span-2 justify-self-end">Date</div>
24 </div>
25 {{ range $index, $commit := .Commits }}
26 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
27 <div class="{{ $grid }} py-3">
28 <div class="align-top col-span-3">
29 {{ template "attribution" (list $commit $.EmailToDid) }}
30 </div>
31 <div class="align-top font-mono flex items-start col-span-3">
32 {{ $verified := $.VerifiedCommits.IsVerified $commit.Hash.String }}
33 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }}
34 {{ if $verified }}
35 {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }}
36 {{ end }}
37 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
38 {{ if $commit.ChangeId }}title="jj change id: {{ $commit.ChangeId }}"{{ end }}
39 class="no-underline hover:underline {{ $hashStyle }} px-2 py-1/2 rounded flex items-center gap-2">
40 {{ slice $commit.Hash.String 0 8 }}
41 {{ if $verified }}
42 {{ i "shield-check" "w-4 h-4" }}
43 {{ end }}
44 </a>
45 <div class="{{ if not $verified }} ml-6 {{ end }}inline-flex">
46 <button class="p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
47 title="Copy SHA"
48 onclick="navigator.clipboard.writeText('{{ $commit.Hash.String }}'); this.innerHTML=`{{ i "copy-check" "w-4 h-4" }}`; setTimeout(() => this.innerHTML=`{{ i "copy" "w-4 h-4" }}`, 1500)">
49 {{ i "copy" "w-4 h-4" }}
50 </button>
51 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ $commit.Hash.String }}" class="p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" title="Browse repository at this commit">
52 {{ i "folder-code" "w-4 h-4" }}
53 </a>
54 </div>
55
56 </div>
57 <div class="align-top col-span-6">
58 <div>
59 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" class="dark:text-white no-underline hover:underline">{{ index $messageParts 0 }}</a>
60
61 {{ if gt (len $messageParts) 1 }}
62 <button class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 dark:bg-gray-700 dark:hover:bg-gray-600 rounded" hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')">{{ i "ellipsis" "w-3 h-3" }}</button>
63 {{ end }}
64
65 {{ if index $.TagMap $commit.Hash.String }}
66 {{ range $tag := index $.TagMap $commit.Hash.String }}
67 <span class="ml-2 text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 inline-flex items-center">
68 {{ $tag }}
69 </span>
70 {{ end }}
71 {{ end }}
72
73 <!-- ci status -->
74 <span class="text-xs">
75 <span id="pipeline-status-{{ $commit.Hash.String }}"></span>
76 </span>
77 </div>
78
79 {{ if gt (len $messageParts) 1 }}
80 <p class="hidden mt-1 text-sm text-gray-600 dark:text-gray-400">{{ nl2br (index $messageParts 1) }}</p>
81 {{ end }}
82 </div>
83 <div class="align-top justify-self-end text-gray-500 dark:text-gray-400 col-span-2">{{ template "repo/fragments/shortTimeAgo" $commit.Committer.When }}</div>
84 </div>
85 {{ end }}
86 </div>
87
88 <!-- mobile view (visible only on small screens) -->
89 <div class="md:hidden">
90 {{ range $index, $commit := .Commits }}
91 <div class="relative p-2 mb-2 {{ if ne $index (sub (len $.Commits) 1) }}border-b border-gray-200 dark:border-gray-700{{ end }}">
92 <div id="commit-message">
93 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
94 <div class="text-base cursor-pointer">
95 <div class="flex items-center justify-between">
96 <div class="flex-1">
97 <div>
98 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
99 class="inline no-underline hover:underline dark:text-white">
100 {{ index $messageParts 0 }}
101 </a>
102 {{ if gt (len $messageParts) 1 }}
103 <button
104 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600"
105 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')">
106 {{ i "ellipsis" "w-3 h-3" }}
107 </button>
108 {{ end }}
109
110 {{ if index $.TagMap $commit.Hash.String }}
111 {{ range $tag := index $.TagMap $commit.Hash.String }}
112 <span class="ml-2 text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 inline-flex items-center">
113 {{ $tag }}
114 </span>
115 {{ end }}
116 {{ end }}
117 </div>
118
119 {{ if gt (len $messageParts) 1 }}
120 <p class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300">
121 {{ nl2br (index $messageParts 1) }}
122 </p>
123 {{ end }}
124 </div>
125 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ $commit.Hash.String }}"
126 class="p-1 mr-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
127 title="Browse repository at this commit">
128 {{ i "folder-code" "w-4 h-4" }}
129 </a>
130 </div>
131 </div>
132 </div>
133
134 <div class="text-xs mt-2 text-gray-500 dark:text-gray-400 flex items-center [&>:not(:empty)~:not(:empty)]:before:content-['·'] [&>:not(:empty)~:not(:empty)]:before:mx-1 [&>:not(:empty)~:not(:empty)]:before:select-none">
135 {{ $verified := $.VerifiedCommits.IsVerified $commit.Hash.String }}
136 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }}
137 {{ if $verified }}
138 {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }}
139 {{ end }}
140 <span class="font-mono">
141 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
142 {{ if $commit.ChangeId }}title="jj change id: {{ $commit.ChangeId }}"{{ end }}
143 class="no-underline hover:underline {{ $hashStyle }} px-2 py-1 rounded flex items-center gap-2">
144 {{ slice $commit.Hash.String 0 8 }}
145 {{ if $verified }}
146 {{ i "shield-check" "w-3 h-3" }}
147 {{ end }}
148 </a>
149 </span>
150 {{ template "attribution" (list $commit $.EmailToDid) }}
151 <span>{{ template "repo/fragments/shortTime" $commit.Committer.When }}</span>
152
153 <!-- ci status -->
154 <span id="pipeline-status-{{ $commit.Hash.String }}"></span>
155 </div>
156 </div>
157 {{ end }}
158 </div>
159
160 {{ if and .Commits .RepoInfo.Spindle }}
161 <div
162 class="hidden"
163 hx-get="/{{ .RepoInfo.FullName }}/commit-statuses?{{ range .Commits }}sha={{ .Hash.String }}&{{ end }}"
164 hx-trigger="load"
165 hx-swap="none"
166 ></div>
167 {{ end }}
168</section>
169
170{{ end }}
171
172{{ define "attribution" }}
173 {{ $commit := index . 0 }}
174 {{ $map := index . 1 }}
175 <span class="flex items-center gap-1">
176 {{ $author := index $map $commit.Author.Email }}
177 {{ $coauthors := $commit.CoAuthors }}
178 {{ $all := list }}
179
180 {{ if $author }}
181 {{ $all = append $all $author }}
182 {{ end }}
183 {{ range $coauthors }}
184 {{ $co := index $map .Email }}
185 {{ if $co }}
186 {{ $all = append $all $co }}
187 {{ end }}
188 {{ end }}
189
190 {{ if $author }}
191 {{ template "fragments/tinyAvatarList" (dict "all" $all "classes" "size-6") }}
192 {{ else }}
193 {{ placeholderAvatar "tiny" }}
194 {{ end }}
195 <a href="{{ if $author }}/{{ $author }}{{ else }}mailto:{{ $commit.Author.Email }}{{ end }}"
196 class="no-underline hover:underline">
197 {{ if $author }}{{ resolve $author }}{{ else }}{{ $commit.Author.Name }}{{ end }}
198 {{ if $coauthors }} +{{ length $coauthors }}{{ end }}
199 </a>
200 </span>
201{{ end }}
202
203{{ define "repoAfter" }}
204 {{ $commits_len := len .Commits }}
205 <div class="flex justify-end mt-4 gap-2">
206 {{ if gt .Page 1 }}<a class="btn flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:hover:bg-gray-700" hx-boost="true" onclick="window.location.href = window.location.pathname + '?page={{ sub .Page 1 }}'">{{ i "chevron-left" "w-4 h-4" }} Previous</a>{{ else }}<div></div>{{ end }}
207 {{ if eq $commits_len 60 }}<a class="btn flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:hover:bg-gray-700" hx-boost="true" onclick="window.location.href = window.location.pathname + '?page={{ add .Page 1 }}'">Next {{ i "chevron-right" "w-4 h-4" }}</a>{{ end }}
208 </div>
209{{ end }}