navid/veinsforge / 7946f29afb883551834b94abc11ca8b57d1c78c154d96be4b40191eedc400018 / internal/web/templates/pull.html
pull.html
← internal/web/templates · 3236 bytes · raw · download
{{define "content"}}
<p class="kicker"><a href="{{repoURL .Data.Repo}}">{{.Data.Repo.OwnerName}}/{{.Data.Repo.Name}}</a> / pull #{{.Data.Pull.Number}}</p>
<h1>{{.Data.Pull.Title}}</h1>
<p class="muted">
<span class="state {{stateClass .Data.Pull.State}}">{{.Data.Pull.State}}</span>
· <code>{{.Data.Pull.HeadBranch}}</code> → <code>{{.Data.Pull.BaseBranch}}</code>
· opened by <a href="/u/{{.Data.Pull.AuthorName}}">{{.Data.Pull.AuthorName}}</a> {{timeago .Data.Pull.CreatedAt}}
{{if .Data.CanMerge}}
· <form method="post" action="{{repoURL .Data.Repo}}/pulls/{{.Data.Pull.Number}}/merge" class="inline">
<input type="hidden" name="csrf" value="{{.CSRF}}"><button class="link" type="submit">merge</button>
</form>
{{end}}
{{if .Data.CanClose}}
· <form method="post" action="{{repoURL .Data.Repo}}/pulls/{{.Data.Pull.Number}}/state" class="inline">
<input type="hidden" name="csrf" value="{{.CSRF}}">
{{if eq .Data.Pull.State "open"}}<input type="hidden" name="state" value="closed"><button class="link" type="submit">close</button>
{{else}}<input type="hidden" name="state" value="open"><button class="link" type="submit">reopen</button>{{end}}
</form>
{{end}}
</p>
{{if eq .Data.Pull.State "merged"}}
<p>Merged as <a href="{{commitURL .Data.Repo .Data.Pull.MergeCommit}}"><code>{{short .Data.Pull.MergeCommit}}</code></a>.</p>
{{end}}
<div class="post">
<p class="muted small"><strong>{{.Data.Pull.AuthorName}}</strong> · {{timeago .Data.Pull.CreatedAt}}</p>
<div class="markdown">{{.Data.BodyHTML}}</div>
</div>
{{if .Data.Attachments}}
<h2>Attachments</h2>
<ul class="link-list">{{range .Data.Attachments}}<li><a href="/attachments/{{.ID}}">{{.Filename}}</a></li>{{end}}</ul>
{{end}}
<h2>Changes</h2>
{{if .Data.DiffError}}<p class="flash flash-error">{{.Data.DiffError}}</p>
{{else if .Data.DiffLines}}
<pre class="diff">{{range .Data.DiffLines}}<span class="diff-line {{.Class}}">{{.Text}}</span>{{end}}</pre>
{{if .Data.Truncated}}<p class="muted small">Diff truncated at 2 MiB.</p>{{end}}
{{else}}<p class="muted">No changes between these commits.</p>{{end}}
<div id="comments">
{{range .Data.Comments}}
<div class="post">
<p class="muted small"><strong><a href="/u/{{.AuthorName}}">{{.AuthorName}}</a></strong> · {{timeago .CreatedAt}}</p>
<div class="markdown">{{.BodyHTML}}</div>
</div>
{{else}}
<p class="muted">No comments yet.</p>
{{end}}
</div>
{{if .Data.CanComment}}
<h2>Add a comment</h2>
<form method="post" action="{{repoURL .Data.Repo}}/pulls/{{.Data.Pull.Number}}/comments" class="form-narrow">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<textarea name="body" rows="8" required maxlength="65536" placeholder="Markdown is supported."></textarea>
<button class="btn" type="submit">Comment</button>
</form>
<form method="post" action="{{repoURL .Data.Repo}}/attachments" enctype="multipart/form-data" class="attach-form">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<input type="hidden" name="subject_type" value="pull">
<input type="hidden" name="subject_id" value="{{.Data.Pull.ID}}">
<input type="file" name="file" required>
<button class="btn" type="submit">Upload attachment</button>
</form>
{{end}}
{{end}}