repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

git-pr / tmpl / components
Eric Bower  ·  2025-12-02

patchset.html

 1{{define "patchset"}}
 2<div class="group">
 3  <div class="flex gap-2 collapse">
 4    <div class="group patchset-list" style="width: 350px;">
 5      <h2 class="text-xl">
 6        Patchset <code>ps-{{.Patchset.ID}}</code>
 7      </h2>
 8
 9      {{range $patch := .Patches}}
10      <div class="box{{if $patch.Review}}-review{{end}} group">
11          <div>
12            <h3 class="text-lg text-transform-none m-0 p-0 mb mono">
13              {{if $patch.Review}}<code class="pill-review">REVIEW</code>{{end}}
14              <a href="#{{$patch.Url}}" class="word-break-word">{{$patch.Title}}</a>
15            </h3>
16
17            <div class="flex justify-between items-center text-sm">
18              <div>
19                <code class="{{if $patch.Review}}pill-review{{end}}">{{$patch.AuthorName}}</code>
20              </div>
21              <date>{{$patch.FormattedAuthorDate}}</date>
22            </div>
23          </div>
24
25          {{range $patch.PatchFiles}}
26            <div class="flex justify-between items-center text-sm">
27              {{if .NewName}}
28              <a class="flex-1 word-break-word mono" href="#patch-{{$patch.ID}}-{{.NewName}}">{{.NewName}}</a>
29              {{else}}
30              <a class="flex-1 word-break-word mono" href="#patch-{{$patch.ID}}-{{.OldName}}">{{.OldName}}</a>
31              {{end}}
32              <div class="flex gap">
33                <code class="pill-success">+{{.Adds}}</code>
34                <code class="pill-admin">-{{.Dels}}</code>
35              </div>
36            </div>
37          {{end}}
38        </div>
39      {{else}}
40        <div class="box">
41          No patches found for patch request.
42        </div>
43      {{end}}
44
45      <div><a href="#top" class="text-sm">Back to top</a></div>
46    </div>
47
48    <div class="max-w flex-1">
49      {{range $patch := .Patches}}
50        <div class="group" id="{{$patch.Url}}">
51          <div class="box">
52            <h3 class="text-lg text-transform-none mono mb-0"><a href="#{{$patch.Url}}">{{$patch.Title}}</a></h3>
53          </div>
54
55          {{if $patch.Body}}<pre class="w-full">{{$patch.Body}}</pre>{{end}}
56
57          {{range $patch.PatchFiles}}
58            {{if .NewName}}
59            <details class="details-min" open="true" id="patch-{{$patch.ID}}-{{.NewName}}">
60              <summary class="patch-file">
61                <code class="pill-success">+{{.Adds}}</code>
62                <code class="pill-admin">-{{.Dels}}</code>
63                <span class="mono ml">{{.NewName}}</span>
64                <a href="#patch-{{$patch.ID}}-{{.NewName}}" class="word-break-word">link</a>
65              </summary>
66              {{if .IsBinary}}
67              <div><pre>Binaries are not rendered as diffs.</pre></div>
68              {{else}}
69              <div>{{.DiffText}}</div>
70              {{end}}
71            </details>
72            {{else}}
73            <details class="details-min" open="true" id="patch-{{$patch.ID}}-{{.OldName}}">
74              <summary class="patch-file">
75                <code class="pill-success">+{{.Adds}}</code>
76                <code class="pill-admin">-{{.Dels}}</code>
77                <span class="mono ml">{{.OldName}}</span>
78                <a href="#patch-{{$patch.ID}}-{{.OldName}}" class="word-break-word">link</a>
79              </summary>
80              {{if .IsBinary}}
81              <div><pre>Binaries are not rendered as diffs.</pre></div>
82              {{else}}
83              <div>{{.DiffText}}</div>
84              {{end}}
85            </details>
86            {{end}}
87          {{end}}
88        </div>
89        <hr class="my" />
90      {{else}}
91        <div class="box">
92          No patches found for patch request.
93        </div>
94      {{end}}
95    </div>
96  </div>
97</div>
98{{end}}