@@ -0,0 +1,128 @@ |
| 1 | +{{ define "page" -}} |
| 2 | +<section class="shithub-pull-view"> |
| 3 | + <header class="shithub-pull-head"> |
| 4 | + <h1> |
| 5 | + <span>{{ .PR.ITitle }}</span> |
| 6 | + <span class="shithub-issue-num">#{{ .PR.INumber }}</span> |
| 7 | + </h1> |
| 8 | + <div class="shithub-issue-meta"> |
| 9 | + {{ if .PR.MergedAt.Valid }} |
| 10 | + <span class="shithub-pill shithub-pull-merged">⏵ Merged</span> |
| 11 | + {{ else if eq (printf "%s" .PR.IState) "open" }} |
| 12 | + <span class="shithub-pill shithub-issues-state-open">{{ if .PR.Draft }}◔ Draft{{ else }}● Open{{ end }}</span> |
| 13 | + {{ else }} |
| 14 | + <span class="shithub-pill shithub-issues-state-closed">✗ Closed</span> |
| 15 | + {{ end }} |
| 16 | + {{ if .AuthorName }}<a href="/{{ .AuthorName }}">{{ .AuthorName }}</a>{{ end }} |
| 17 | + wants to merge <code>{{ .PR.HeadRef }}</code> into <code>{{ .PR.BaseRef }}</code> |
| 18 | + </div> |
| 19 | + </header> |
| 20 | + |
| 21 | + <nav class="shithub-pull-tabs"> |
| 22 | + <a class="shithub-pull-tab {{ if eq .Tab "conversation" }}shithub-pull-tab-active{{ end }}" |
| 23 | + href="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}">Conversation</a> |
| 24 | + <a class="shithub-pull-tab {{ if eq .Tab "commits" }}shithub-pull-tab-active{{ end }}" |
| 25 | + href="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/commits">Commits</a> |
| 26 | + <a class="shithub-pull-tab {{ if eq .Tab "files" }}shithub-pull-tab-active{{ end }}" |
| 27 | + href="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/files">Files changed</a> |
| 28 | + <a class="shithub-pull-tab {{ if eq .Tab "checks" }}shithub-pull-tab-active{{ end }}" |
| 29 | + href="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/checks">Checks</a> |
| 30 | + </nav> |
| 31 | + |
| 32 | + {{ if eq .Tab "conversation" }} |
| 33 | + <div class="shithub-pull-grid"> |
| 34 | + <article class="shithub-issue-thread"> |
| 35 | + <div class="shithub-comment"> |
| 36 | + <div class="shithub-comment-head"> |
| 37 | + {{ if .AuthorName }}<a href="/{{ .AuthorName }}">{{ .AuthorName }}</a>{{ end }} |
| 38 | + <time datetime="{{ .PR.ICreatedAt.Time.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .PR.ICreatedAt.Time }}</time> |
| 39 | + </div> |
| 40 | + <div class="shithub-comment-body markdown-body"> |
| 41 | + {{ if .PR.IBodyHtmlCached.Valid }}{{ safeHTML .PR.IBodyHtmlCached.String }}{{ else }}<p>{{ .PR.IBody }}</p>{{ end }} |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + {{ range .Comments }} |
| 45 | + <div class="shithub-comment"> |
| 46 | + <div class="shithub-comment-head"> |
| 47 | + {{ if .AuthorName }}<a href="/{{ .AuthorName }}">{{ .AuthorName }}</a>{{ end }} |
| 48 | + commented |
| 49 | + <time datetime="{{ .C.CreatedAt.Time.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .C.CreatedAt.Time }}</time> |
| 50 | + </div> |
| 51 | + <div class="shithub-comment-body markdown-body"> |
| 52 | + {{ if .C.BodyHtmlCached.Valid }}{{ safeHTML .C.BodyHtmlCached.String }}{{ else }}<p>{{ .C.Body }}</p>{{ end }} |
| 53 | + </div> |
| 54 | + </div> |
| 55 | + {{ end }} |
| 56 | + {{ range .Events }} |
| 57 | + <div class="shithub-event"> |
| 58 | + <span class="shithub-event-kind">{{ .Kind }}</span> |
| 59 | + <time datetime="{{ .CreatedAt.Time.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .CreatedAt.Time }}</time> |
| 60 | + </div> |
| 61 | + {{ end }} |
| 62 | + </article> |
| 63 | + |
| 64 | + <aside class="shithub-pull-merge"> |
| 65 | + {{ if .PR.MergedAt.Valid }} |
| 66 | + <p>Merged via <code>{{ printf "%s" .PR.MergeMethod.PrMergeMethod }}</code>.</p> |
| 67 | + {{ else if eq (printf "%s" .PR.IState) "closed" }} |
| 68 | + <p>This PR is closed without being merged.</p> |
| 69 | + {{ else }} |
| 70 | + <h3>Mergeability</h3> |
| 71 | + <p class="shithub-pull-state-{{ printf "%s" .PR.MergeableState }}"> |
| 72 | + {{ printf "%s" .PR.MergeableState }} |
| 73 | + </p> |
| 74 | + {{ if .Viewer.ID }} |
| 75 | + {{ if eq (printf "%s" .PR.MergeableState) "clean" }} |
| 76 | + <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/merge" class="shithub-pull-merge-form"> |
| 77 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 78 | + <select name="method"> |
| 79 | + {{ if .Repo.AllowMergeCommit }}<option value="merge" {{ if eq (printf "%s" .Repo.DefaultMergeMethod) "merge" }}selected{{ end }}>Merge commit</option>{{ end }} |
| 80 | + {{ if .Repo.AllowSquashMerge }}<option value="squash" {{ if eq (printf "%s" .Repo.DefaultMergeMethod) "squash" }}selected{{ end }}>Squash and merge</option>{{ end }} |
| 81 | + {{ if .Repo.AllowRebaseMerge }}<option value="rebase" {{ if eq (printf "%s" .Repo.DefaultMergeMethod) "rebase" }}selected{{ end }}>Rebase and merge</option>{{ end }} |
| 82 | + </select> |
| 83 | + <button type="submit" class="shithub-button shithub-button-primary">Merge pull request</button> |
| 84 | + </form> |
| 85 | + {{ else if eq (printf "%s" .PR.MergeableState) "dirty" }} |
| 86 | + <p class="shithub-error">This branch has conflicts that must be resolved manually.</p> |
| 87 | + {{ else if eq (printf "%s" .PR.MergeableState) "behind" }} |
| 88 | + <p class="shithub-muted">Head has no commits ahead of base.</p> |
| 89 | + {{ else }} |
| 90 | + <p class="shithub-muted">Mergeability is being computed…</p> |
| 91 | + {{ end }} |
| 92 | + <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/state" class="shithub-pull-state-form"> |
| 93 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 94 | + <button type="submit" name="state" value="closed" class="shithub-button">Close pull request</button> |
| 95 | + </form> |
| 96 | + {{ if .PR.Draft }} |
| 97 | + <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/ready"> |
| 98 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 99 | + <button type="submit" class="shithub-button">Ready for review</button> |
| 100 | + </form> |
| 101 | + {{ end }} |
| 102 | + {{ end }} |
| 103 | + {{ end }} |
| 104 | + </aside> |
| 105 | + </div> |
| 106 | + {{ else if eq .Tab "commits" }} |
| 107 | + <ul class="shithub-pull-commits"> |
| 108 | + {{ range .Commits }} |
| 109 | + <li> |
| 110 | + <a href="/{{ $.Owner }}/{{ $.Repo.Name }}/commit/{{ .Sha }}"><code>{{ slice .Sha 0 7 }}</code></a> |
| 111 | + {{ .Subject }} |
| 112 | + <small>by {{ .AuthorName }}</small> |
| 113 | + </li> |
| 114 | + {{ else }} |
| 115 | + <li class="shithub-muted">No commits.</li> |
| 116 | + {{ end }} |
| 117 | + </ul> |
| 118 | + {{ else if eq .Tab "files" }} |
| 119 | + {{ if .DiffHTML }} |
| 120 | + <div class="shithub-diff">{{ safeHTML .DiffHTML }}</div> |
| 121 | + {{ else }} |
| 122 | + <p class="shithub-muted">No diff available.</p> |
| 123 | + {{ end }} |
| 124 | + {{ else if eq .Tab "checks" }} |
| 125 | + <p class="shithub-muted">Check engine ships in S24. Today this tab is a placeholder.</p> |
| 126 | + {{ end }} |
| 127 | +</section> |
| 128 | +{{- end }} |