blog/root/comments/comments.partial.gohtml

36 lines
935 B
Plaintext

{{ $t := .Thread }}
{{ $a := .Authors }}
<p>
{{- if eq (len $t.Comments) 1 -}}
There is 1 comment on this page.
{{- else -}}
There are {{ len $t.Comments }} comments on this page.
{{- end }}
<a href="#add-comment">Add yours.</a>
</p>
{{ range $t.Comments }}
{{ template "comment" . }}
{{ end }}
<h3 id="add-comment">Add a Comment</h3>
<form action="/comments" method="POST">
<input type="hidden" name="_csrf" value="{{ .CSRF }}">
<input type="hidden" name="thread" value="{{ .Thread.ID }}">
<input type="hidden" name="subject" value="{{ .Subject }}">
<input type="hidden" name="origin" value="{{ .OriginURL }}">
{{ template "comment-form" .NewComment }}
<button type="submit"
name="submit"
value="preview"
class="btn btn-primary">Preview</button>
<button type="submit"
name="submit"
value="post"
class="btn btn-danger">Post</button>
</form>