e17a0b8f951af062eac19c12c5c59fe429d959b5 / internal/web/templates/pull.html · 2786 bytes · raw
{{define "title"}}#{{.Number}} {{.Title}} · {{.Owner}}/{{.RepoName}} · simplegit{{end}}
{{define "content"}}
{{template "repo_nav" .}}
<h2><span class="muted">#{{.Number}}</span> {{.Title}}</h2>
{{template "pstate" .}}
<p class="issue-meta muted"><code>{{.Head}}</code> → <code>{{.Base}}</code> · opened by {{.Author}}{{if .AuthorIsOwner}} <span class="badge">owner</span>{{end}}{{if .IsOwner}}{{if .AuthorEmail}} <{{.AuthorEmail}}>{{end}}{{end}} · {{.Created}}{{if .MergeCommit}} · merged as <code>{{.MergeCommit}}</code>{{end}}</p>
{{if .Error}}<p class="error">{{.Error}}</p>{{end}}
<article class="issue-body">{{.BodyHTML}}</article>
<h2>changes</h2>
{{if .DiffHTML}}<article class="diff">{{.DiffHTML}}</article>{{else}}<p class="muted">{{.DiffNotice}}</p>{{end}}
{{if .Submitted}}<p class="ok">your comment was submitted and is awaiting review.</p>{{end}}
<h2>comments</h2>
<section id="pcomments">
{{range .Comments}}{{template "comment" .}}{{end}}
</section>
{{if .CanWrite}}
<form id="pcomment-form" method="post" action="{{.BasePath}}/comments"
hx-post="{{.BasePath}}/comments"
hx-target="{{if .IsOwner}}#pcomments{{else}}#pcomment-status{{end}}"
hx-swap="{{if .IsOwner}}beforeend{{else}}innerHTML{{end}}"
hx-on::after-request="if(event.detail.successful) this.reset()">
<p><label for="pcomment-body">comment</label><br>
<textarea id="pcomment-body" name="body" rows="6" required></textarea></p>
{{if not .IsOwner}}{{template "guest_fields" "pcomment_"}}{{end}}
<p class="hp"><label>website <input name="website" tabindex="-1" autocomplete="off"></label></p>
<p><button type="submit">comment</button></p>
</form>
<div id="pcomment-status"></div>
{{end}}
{{end}}
{{define "pstate"}}
<div id="pull-state" class="issue-state">
<span class="badge {{.State}}">{{.State}}</span>
{{if .Pending}}<span class="badge pending">pending</span>{{end}}
{{if .IsOwner}}
{{if .Pending}}
<form method="post" action="{{.BasePath}}/approve"><button class="linklike" type="submit">approve</button></form>
{{end}}
{{if eq .State "open"}}
<form method="post" action="{{.BasePath}}/merge"><button class="linklike" type="submit">merge</button></form>
<form method="post" action="{{.BasePath}}/close" hx-post="{{.BasePath}}/close" hx-target="#pull-state" hx-swap="outerHTML"><button class="linklike" type="submit">close</button></form>
{{else if eq .State "closed"}}
<form method="post" action="{{.BasePath}}/reopen" hx-post="{{.BasePath}}/reopen" hx-target="#pull-state" hx-swap="outerHTML"><button class="linklike" type="submit">reopen</button></form>
{{end}}
<form method="post" action="{{.BasePath}}/delete"><button class="linklike" type="submit">delete</button></form>
{{end}}
</div>
{{end}}