repos / git-pr

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

git-pr / tmpl
Eric Bower  ·  2025-04-14

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 mt">
  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">
 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">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          <h3 class="text-lg text-transform-none mono"><a href="#{{$patch.Url}}">{{$patch.Title}}</a></h3>
 52
 53          {{if $patch.Body}}<pre class="w-full">{{$patch.Body}}</pre>{{end}}
 54
 55          {{range $patch.PatchFiles}}
 56            {{if .NewName}}
 57            <details class="details-min" open="true" id="patch-{{$patch.ID}}-{{.NewName}}">
 58              <summary class="group-h patch-file">
 59                <span class="mono">{{.NewName}}</span>
 60                <a href="#patch-{{$patch.ID}}-{{.NewName}}" class="word-break-word">link</a>
 61                <div class="flex gap">
 62                  <code class="pill-success">+{{.Adds}}</code>
 63                  <code class="pill-admin">-{{.Dels}}</code>
 64                </div>
 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="group-h patch-file">
 75                <span class="mono">{{.OldName}}</span>
 76                <a href="#patch-{{$patch.ID}}-{{.OldName}}" class="word-break-word">link</a>
 77                <div class="flex gap">
 78                  <code class="pill-success">+{{.Adds}}</code>
 79                  <code class="pill-admin">-{{.Dels}}</code>
 80                </div>
 81              </summary>
 82              {{if .IsBinary}}
 83              <div><pre>Binaries are not rendered as diffs.</pre></div>
 84              {{else}}
 85              <div>{{.DiffText}}</div>
 86              {{end}}
 87            </details>
 88            {{end}}
 89          {{end}}
 90        </div>
 91        <hr class="my" />
 92      {{else}}
 93        <div class="box">
 94          No patches found for patch request.
 95        </div>
 96      {{end}}
 97    </div>
 98  </div>
 99</div>
100{{end}}