blog/root/comments/entry.partial.gohtml

54 lines
2.0 KiB
Plaintext

{{ define "comment" }}
<div class="card mb-4">
<div class="card-body">
<div class="row">
<div class="col-2">
<img src="{{ .Avatar }}"
width="96"
height="96"
alt="Avatar image">
</div>
<div class="col-10">
<div class="comment-meta">
{{ if and .UserID .Username }}
<a href="/u/{{ .Username }}"><strong>{{ or .Name "Anonymous" }}</strong></a>
{{ else }}
<strong>{{ or .Name "Anonymous" }}</strong>
{{ end }}
posted on {{ .Created.Format "January 2, 2006 @ 15:04 MST" }}
{{ if .Updated.After .Created }}
<span title="{{ .Updated.Format "Jan 2 2006 @ 15:04:05 MST" }}">
(updated {{ .Updated.Format "1/2/06 15:04 MST"}})
</span>
{{ end }}
</div>
{{ .HTML }}
{{ if .Editable }}
<form action="/comments" method="POST">
<input type="hidden" name="_csrf" value="{{ .CSRF }}">
<input type="hidden" name="id" value="{{ .ID }}">
<input type="hidden" name="thread" value="{{ .ThreadID }}">
<input type="hidden" name="subject" value="(editing)">
<input type="hidden" name="origin" value="{{ .OriginURL }}">
<input type="hidden" name="editing" value="true">
<button type="submit"
name="submit"
value="preview"
class="btn btn-sm btn-primary">edit</button>
<button type="submit"
name="submit"
value="delete"
class="btn btn-sm btn-danger">delete</button>
</form>
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}