blog/root/comments/index.gohtml

55 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

{{ define "title" }}Preview Comment{{ end }}
{{ define "content" }}
{{ with .Data.Comment }}
<form action="/comments" method="POST">
<input type="hidden" name="_csrf" value="{{ $.CSRF }}">
<input type="hidden" name="thread" value="{{ .ThreadID }}">
<input type="hidden" name="subject" value="{{ .Subject }}">
<input type="hidden" name="origin" value="{{ .OriginURL }}">
{{ if $.Data.Editing -}}
<input type="hidden" name="id" value="{{ .ID }}">
<input type="hidden" name="editing" value="{{ $.Data.Editing }}">
{{ end }}
<h1>
{{- if $.Data.Deleting -}}
Delete Comment
{{- else if $.Data.Editing -}}
Edit Comment
{{- else -}}
Preview
{{- end -}}
</h1>
<hr>
{{ template "comment" . }}
<hr>
{{ if $.Data.Deleting }}
<p>Are you sure you want to delete this comment?</p>
<button type="submit"
name="submit"
value="confirm-delete"
class="btn btn-danger">
Delete Comment
</button>
<a href="{{ .OriginURL }}" class="btn btn-primary">Cancel</a>
{{ else }}
{{ template "comment-form" . }}
<button type="submit" name="submit" value="preview" class="btn btn-primary">
Refresh Preview
</button>
<button type="submit" name="submit" value="post" class="btn btn-secondary">
Post Comment
</button>
{{ end }}
</form>
{{ end }}
{{ end }}