this repo has no description
1{{ define "title" }} commit {{ .Diff.Commit.This }} · {{ .RepoInfo.FullName }} {{ end }}
2
3{{ define "repoContent" }}
4
5{{ $repo := .RepoInfo.FullName }}
6{{ $commit := .Diff.Commit }}
7{{ $stat := .Diff.Stat }}
8{{ $diff := .Diff.Diff }}
9
10<section class="commit">
11 <div id="commit-message">
12 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
13 <div>
14 <p class="pb-2">{{ index $messageParts 0 }}</p>
15 {{ if gt (len $messageParts) 1 }}
16 <p class="mt-1 cursor-text pb-2 text-sm">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>
17 {{ end }}
18 </div>
19 </div>
20
21 <div class="flex items-center">
22 <p class="text-sm text-gray-500">
23 <a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500">{{ $commit.Author.Name }}</a>
24 <span class="px-1 select-none before:content-['\00B7']"></span>
25 {{ timeFmt $commit.Author.When }}
26 <span class="px-1 select-none before:content-['\00B7']"></span>
27 <span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span>
28 <span class="px-1 select-none before:content-['\00B7']"></span>
29 </p>
30
31 <p class="flex items-center text-sm text-gray-500">
32 <a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.This 0 8 }}</a>
33 {{ if $commit.Parent }}
34 <i class="w-3 h-3 mx-1" data-lucide="arrow-left"></i>
35 <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.Parent 0 8 }}</a>
36 {{ end }}
37 </p>
38 </div>
39
40 <div class="diff-stat">
41 <br>
42 <strong class="text-sm uppercase">Affected files</strong>
43 {{ range $diff }}
44 <ul>
45 {{ if .Name.New }}
46 <li><a href="#file-{{ .Name.New }}">{{ .Name.New }}</a></li>
47 {{ else }}
48 <li><a href="#file-{{ .Name.Old }}">{{ .Name.Old }}</a></li>
49 {{ end }}
50 </ul>
51 </div>
52</section>
53{{end}}
54{{end}}
55
56{{ define "repoAfter" }}
57
58{{ $repo := .RepoInfo.FullName }}
59{{ $commit := .Diff.Commit }}
60{{ $stat := .Diff.Stat }}
61{{ $diff := .Diff.Diff }}
62
63 {{ $this := $commit.This }}
64 {{ $parent := $commit.Parent }}
65
66 {{ $last := sub (len $diff) 1 }}
67 {{ range $idx, $hunk := $diff }}
68 {{ with $hunk }}
69 <section class="mt-4 border border-gray-200 w-full mx-auto">
70 <div id="file-{{ .Name.New }}">
71 <div id="diff-file">
72 <details open>
73 <summary class="list-none cursor-pointer sticky top-0">
74 <div id="diff-file-header" class="border-b cursor-pointer bg-white border-gray-200 flex justify-between">
75 <div id="left-side-items" class="p-2">
76 {{ if .IsNew }}
77 <span class="diff-type p-1 mr-1 font-mono text-sm bg-green-100 rounded text-green-700 select-none">A</span>
78 {{ end }}
79 {{ if .IsDelete }}
80 <span class="diff-type p-1 mr-1 font-mono text-sm bg-red-100 rounded text-red-700 select-none">D</span>
81 {{ end }}
82 {{ if not (or .IsNew .IsDelete) }}
83 <span class="diff-type p-1 mr-1 font-mono bg-gray-100 text-sm rounded text-gray-700 select-none">M</span>
84 {{ end }}
85
86 {{ $name := .Name.New}}
87 {{ if .IsDelete }}
88 {{ $name = .Name.Old }}
89 {{ end }}
90 <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}" class="no-underline hover:underline">{{ $name }}</a>
91 </div>
92
93 {{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 rounded" }}
94 <div id="right-side-items" class="p-2 flex items-center">
95 <a title="top of file" href="#file-{{ .Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-up-from-line"></i></a>
96 {{ if gt $idx 0 }}
97 {{ $prev := index $diff (sub $idx 1) }}
98 <a title="previous file" href="#file-{{ $prev.Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-up"></i></a>
99 {{ end }}
100
101 {{ if lt $idx $last }}
102 {{ $next := index $diff (add $idx 1) }}
103 <a title="next file" href="#file-{{ $next.Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-down"></i></a>
104 {{ end }}
105 </div>
106
107 </div>
108 </summary>
109
110
111 {{ if .IsDelete }}
112 <p class="text-center p-4 text-gray-400">This file as been deleted.</p>
113 {{ else }}
114 {{ if .IsBinary }}
115 <p class="text-center p-4 text-gray-400">Not showing binary file.</p>
116 {{ else }}
117 <pre class="overflow-auto">
118 {{- range .TextFragments -}}
119 <div class="bg-gray-100 text-gray-500 select-none">{{ .Header }}</div>
120 {{- range .Lines -}}
121 {{- if eq .Op.String "+" -}}
122 <div class="bg-green-100 text-green-700 p-1"><span class="select-none mr-2">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
123 {{- end -}}
124
125 {{- if eq .Op.String "-" -}}
126 <div class="bg-red-100 text-red-700 p-1"><span class="select-none mr-2">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
127 {{- end -}}
128
129 {{- if eq .Op.String " " -}}
130 <div class="text-gray-500 px"><span class="select-none mr-2">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
131 {{- end -}}
132
133 {{- end -}}
134 {{- end -}}
135 </pre>
136 {{- end -}}
137 {{- end -}}
138
139 </details>
140
141 </div>
142 </div>
143 </section>
144 {{ end }}
145 {{ end }}
146
147{{end}}