{{/*
Line selection in the prose diff. Deferred and unconditional: the script is
pure enhancement (folding is a checkbox, commenting is a <details> with a
plain form), so nothing on this page waits for it and nothing breaks if it
never arrives.
*/}}
{{define "head"}}
<script src="/static/diff.js" defer></script>
{{end}}
{{define "content"}}
{{$p := .Data.Proposal}}
<div class="row">
<div class="col-md-12">
<p class="text-muted">
<a href="{{.Data.SpaceHref}}">{{$p.Space}}</a>
</p>
<h2>
Proposal #{{$p.ID}}
<span class="badge {{.Data.StateBadge}}">{{$p.State}}</span>
</h2>
<h3 class="h5">{{$p.Title}}</h3>
{{if $p.Rationale}}<p>{{$p.Rationale}}</p>{{end}}
<p class="text-muted">
<small>
proposed by <code>{{$p.Agent}}</code>
(session <code>{{$p.AgentSession}}</code>)
against <code title="{{$p.BaseRev}}">{{shortsha $p.BaseRev}}</code>
{{if .Data.Merged}}
— merged as <span class="badge badge-secondary">{{$p.Approval}}</span>
at <code title="{{$p.MergedRev}}">{{shortsha $p.MergedRev}}</code>
{{end}}
</small>
</p>
{{if .Data.Unresolved}}
<p class="text-muted">
<small>
<span class="badge badge-warning">{{.Data.Unresolved}} unresolved</span>
Policy auto-merge is suppressed while a review thread is open; approving
by hand still works.
</small>
</p>
{{end}}
{{if .Data.CanApprove}}
<div class="proposal-actions">
<form method="POST" action="/{{$p.Space}}/p/{{$p.ID}}/approve" class="d-inline">
<button type="submit" class="btn btn-success">Approve & merge</button>
</form>
<form method="POST" action="/{{$p.Space}}/p/{{$p.ID}}/reject" class="d-inline">
<button type="submit" class="btn btn-outline-danger">Reject</button>
</form>
</div>
{{else if .Data.Merged}}
<p class="text-success">This proposal has been merged.</p>
{{else if .Data.Rejected}}
<p class="text-danger">This proposal was rejected.</p>
{{end}}
</div>
</div>
<div class="row">
<div class="col-md-12">
{{if .Data.Docs}}
{{range .Data.Docs}}
<div class="proposal-doc">
<h4 class="h6">
<code>{{.Path}}</code>
{{if .New}}<span class="badge badge-success">new</span>{{end}}
</h4>
{{if .Diff.Unchanged}}
<p class="text-muted"><small>No textual change.</small></p>
{{else}}
{{.Diff.HTML}}
{{end}}
</div>
{{end}}
{{else}}
<p class="text-muted">This proposal changes no documents.</p>
{{end}}
{{/*
Comments whose block is gone. They are shown here, whole, rather than
moved onto whatever block now sits nearest: a critique read against the
wrong paragraph is worse than one that admits it lost its place, because
the reader cannot tell it is wrong.
*/}}
{{if .Data.Lost}}
<div class="proposal-doc ph-lost">
<h4 class="h6">
Comments that lost their anchor
<span class="badge badge-warning">{{len .Data.Lost}}</span>
</h4>
<p class="text-muted">
<small>
The blocks these were written about are no longer in the proposed
revision. They are kept as written and attached to nothing.
</small>
</p>
{{range .Data.Lost}}{{template "thread" .}}{{end}}
</div>
{{end}}
</div>
</div>
{{end}}