this repo has no description
1{{ define "title" }}commits · {{ .RepoInfo.FullName }}{{ end }}
2{{ define "repoContent" }}
3<section id="commit-table" class="overflow-x-auto">
4 <!-- desktop view (hidden on small screens) -->
5 <table class="w-full border-collapse hidden md:table">
6 <thead class="bg-gray-100 dark:bg-gray-700">
7 <tr>
8 <th class="px-4 py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Author</th>
9 <th class="px-4 py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Commit</th>
10 <th class="px-4 py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Message</th>
11 <th class="px-4 py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Date</th>
12 </tr>
13 </thead>
14 <tbody>
15 {{ range $index, $commit := .Commits }}
16 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
17 <tr class="border-b border-gray-200 dark:border-gray-700">
18 <td class="px-4 py-3 align-top">
19 {{ $didOrHandle := index $.EmailToDidOrHandle $commit.Author.Email }}
20 {{ if $didOrHandle }}
21 <a href="/{{ $didOrHandle }}" class="text-gray-700 dark:text-gray-300 no-underline hover:underline">{{ $didOrHandle }}</a>
22 {{ else }}
23 <a href="mailto:{{ $commit.Author.Email }}" class="text-gray-700 dark:text-gray-300 no-underline hover:underline">{{ $commit.Author.Name }}</a>
24 {{ end }}
25 </td>
26 <td class="px-4 py-3 align-top font-mono flex items-end">
27 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" class="text-gray-700 dark:text-gray-300 no-underline hover:underline">{{ slice $commit.Hash.String 0 8 }}</a>
28 <div class="inline-flex">
29 <button class="p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
30 title="Copy SHA"
31 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)">
32 {{ i "copy" "w-4 h-4" }}
33 </button>
34 <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">
35 {{ i "folder-code" "w-4 h-4" }}
36 </a>
37 </div>
38 </td>
39 <td class="px-4 py-3 align-top">
40 {{ if eq $index 0 }}
41 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" class="dark:text-white no-underline hover:underline">
42 <p>{{ index $messageParts 0 }}</p>
43 {{ if gt (len $messageParts) 1 }}<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>{{ end }}
44 </a>
45 {{ else }}
46 <div>
47 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" class="dark:text-white no-underline hover:underline">{{ index $messageParts 0 }}</a>
48 {{ if gt (len $messageParts) 1 }}
49 <button class="ml-2 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.nextElementSibling.classList.toggle('hidden')">{{ i "ellipsis" "w-3 h-3" }}</button>
50 <p class="hidden mt-1 text-sm text-gray-600 dark:text-gray-400">{{ nl2br (index $messageParts 1) }}</p>
51 {{ end }}
52 </div>
53 {{ end }}
54 </td>
55 <td class="px-4 py-3 align-top text-gray-500 dark:text-gray-400">{{ timeFmt $commit.Author.When }}</td>
56 </tr>
57 {{ end }}
58 </tbody>
59 </table>
60
61 <!-- mobile view (visible only on small screens) -->
62 <div class="md:hidden">
63 <h2 class="p-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">commits</h2>
64 {{ range $commit := .Commits }}
65 <div class="relative p-2 border-b border-gray-200 dark:border-gray-700">
66 <div id="commit-message">
67 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
68 <div class="text-base cursor-pointer">
69 <div>
70 <div class="flex items-center justify-between">
71 <div class="flex-1">
72 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
73 class="inline no-underline hover:underline dark:text-white">
74 {{ index $messageParts 0 }}
75 </a>
76 {{ if gt (len $messageParts) 1 }}
77 <button
78 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600"
79 hx-on:click="this.nextElementSibling.classList.toggle('hidden')">
80 {{ i "ellipsis" "w-3 h-3" }}
81 </button>
82 {{ end }}
83 {{ if gt (len $messageParts) 1 }}
84 <p class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300">
85 {{ nl2br (index $messageParts 1) }}
86 </p>
87 {{ end }}
88 </div>
89 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ $commit.Hash.String }}"
90 class="p-1 mr-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
91 title="Browse repository at this commit">
92 {{ i "folder-code" "w-4 h-4" }}
93 </a>
94 </div>
95
96 </div>
97 </div>
98 </div>
99
100 <div class="text-xs text-gray-500 dark:text-gray-400">
101 <span class="font-mono">
102 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
103 class="text-gray-500 dark:text-gray-400 no-underline hover:underline">
104 {{ slice $commit.Hash.String 0 8 }}
105 </a>
106 </span>
107 <span class="mx-2 before:content-['·'] before:select-none"></span>
108 <span>
109 {{ $didOrHandle := index $.EmailToDidOrHandle $commit.Author.Email }}
110 <a href="{{ if $didOrHandle }}/{{ $didOrHandle }}{{ else }}mailto:{{ $commit.Author.Email }}{{ end }}"
111 class="text-gray-500 dark:text-gray-400 no-underline hover:underline">
112 {{ if $didOrHandle }}{{ $didOrHandle }}{{ else }}{{ $commit.Author.Name }}{{ end }}
113 </a>
114 </span>
115 <div class="inline-block px-1 select-none after:content-['·']"></div>
116 <span>{{ shortTimeFmt $commit.Author.When }}</span>
117 </div>
118 </div>
119 {{ end }}
120 </div>
121</section>
122
123 {{ $commits_len := len .Commits }}
124 <div class="flex justify-end mt-4 gap-2">
125 {{ 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 }}
126 {{ 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 }}
127 </div>
128{{ end }}