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 {{ $pipeline := index $.Pipelines .Hash.String }}
76 {{ if $pipeline }}
77 {{ if gt (len $pipeline.Statuses) 0 }}
78 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $pipeline "RepoInfo" $.RepoInfo) }}
79 {{ end }}
80 {{ end }}
81 </span>
82 </div>
83
84 {{ if gt (len $messageParts) 1 }}
85 <p class="hidden mt-1 text-sm text-gray-600 dark:text-gray-400">{{ nl2br (index $messageParts 1) }}</p>
86 {{ end }}
87 </div>
88 <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>
89 </div>
90 {{ end }}
91 </div>
92
93 <!-- mobile view (visible only on small screens) -->
94 <div class="md:hidden">
95 {{ range $index, $commit := .Commits }}
96 <div class="relative p-2 mb-2 {{ if ne $index (sub (len $.Commits) 1) }}border-b border-gray-200 dark:border-gray-700{{ end }}">
97 <div id="commit-message">
98 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
99 <div class="text-base cursor-pointer">
100 <div class="flex items-center justify-between">
101 <div class="flex-1">
102 <div>
103 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
104 class="inline no-underline hover:underline dark:text-white">
105 {{ index $messageParts 0 }}
106 </a>
107 {{ if gt (len $messageParts) 1 }}
108 <button
109 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600"
110 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')">
111 {{ i "ellipsis" "w-3 h-3" }}
112 </button>
113 {{ end }}
114
115 {{ if index $.TagMap $commit.Hash.String }}
116 {{ range $tag := index $.TagMap $commit.Hash.String }}
117 <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">
118 {{ $tag }}
119 </span>
120 {{ end }}
121 {{ end }}
122 </div>
123
124 {{ if gt (len $messageParts) 1 }}
125 <p class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300">
126 {{ nl2br (index $messageParts 1) }}
127 </p>
128 {{ end }}
129 </div>
130 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ $commit.Hash.String }}"
131 class="p-1 mr-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
132 title="Browse repository at this commit">
133 {{ i "folder-code" "w-4 h-4" }}
134 </a>
135 </div>
136 </div>
137 </div>
138
139 <div class="text-xs mt-2 text-gray-500 dark:text-gray-400 flex items-center">
140 {{ $verified := $.VerifiedCommits.IsVerified $commit.Hash.String }}
141 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }}
142 {{ if $verified }}
143 {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }}
144 {{ end }}
145 <span class="font-mono">
146 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
147 {{ if $commit.ChangeId }}title="jj change id: {{ $commit.ChangeId }}"{{ end }}
148 class="no-underline hover:underline {{ $hashStyle }} px-2 py-1 rounded flex items-center gap-2">
149 {{ slice $commit.Hash.String 0 8 }}
150 {{ if $verified }}
151 {{ i "shield-check" "w-3 h-3" }}
152 {{ end }}
153 </a>
154 </span>
155 <span class="mx-2 before:content-['·'] before:select-none"></span>
156 {{ template "attribution" (list $commit $.EmailToDid) }}
157 <div class="inline-block px-1 select-none after:content-['·']"></div>
158 <span>{{ template "repo/fragments/shortTime" $commit.Committer.When }}</span>
159
160 <!-- ci status -->
161 {{ $pipeline := index $.Pipelines .Hash.String }}
162 {{ if $pipeline }}
163 {{ if gt (len $pipeline.Statuses) 0 }}
164 <div class="inline-block px-1 select-none after:content-['·']"></div>
165 <span class="text-sm">
166 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $pipeline "RepoInfo" $.RepoInfo) }}
167 </span>
168 {{ end }}
169 {{ end }}
170 </div>
171 </div>
172 {{ end }}
173 </div>
174</section>
175
176{{ end }}
177
178{{ define "attribution" }}
179 {{ $commit := index . 0 }}
180 {{ $map := index . 1 }}
181 <span class="flex items-center gap-1">
182 {{ $author := index $map $commit.Author.Email }}
183 {{ $coauthors := $commit.CoAuthors }}
184 {{ $all := list }}
185
186 {{ if $author }}
187 {{ $all = append $all $author }}
188 {{ end }}
189 {{ range $coauthors }}
190 {{ $co := index $map .Email }}
191 {{ if $co }}
192 {{ $all = append $all $co }}
193 {{ end }}
194 {{ end }}
195
196 {{ if $author }}
197 {{ template "fragments/tinyAvatarList" (dict "all" $all "classes" "size-6") }}
198 {{ else }}
199 {{ placeholderAvatar "tiny" }}
200 {{ end }}
201 <a href="{{ if $author }}/{{ $author }}{{ else }}mailto:{{ $commit.Author.Email }}{{ end }}"
202 class="no-underline hover:underline">
203 {{ if $author }}{{ resolve $author }}{{ else }}{{ $commit.Author.Name }}{{ end }}
204 {{ if $coauthors }} +{{ length $coauthors }}{{ end }}
205 </a>
206 </span>
207{{ end }}
208
209{{ define "repoAfter" }}
210 {{ $commits_len := len .Commits }}
211 <div class="flex justify-end mt-4 gap-2">
212 {{ 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 }}
213 {{ 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 }}
214 </div>
215{{ end }}