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