A web blog and personal homepage engine written in Go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

55 lines
2.3 KiB

{{ $C := .V.Comment }}
<div class="card mb-4">
<div class="card-body">
<div class="row">
<div class="markdown col-12 col-lg-2 mb-1">
<img src="{{ $C.Avatar }}"
width="96"
height="96"
alt="Avatar image">
</div>
<div class="markdown col-12 col-lg-10">
<div class="comment-meta">
{{ if and $C.UserID $C.User }}
<strong>{{ or $C.Name "Anonymous" }}</strong>
{{ if $C.User.IsAdmin }}<span class="text-danger">(admin)</span>
{{ else }}<span class="text-info">(logged in)</span>{{ end }}
{{ else }}
<strong>{{ or $C.Name "Anonymous" }}</strong>
{{ end }}
posted on {{ $C.CreatedAt.Format "January 2, 2006 @ 15:04 MST" }}
{{ if $C.UpdatedAt.After $C.CreatedAt }}
<span title="{{ $C.UpdatedAt.Format "Jan 2 2006 @ 15:04:05 MST" }}">
(updated {{ $C.UpdatedAt.Format "1/2/06 15:04 MST"}})
</span>
{{ end }}
</div>
{{ $C.HTML }}
{{ if and $C.ID .V.Editable }}
<form action="/comments" method="POST">
{{ CSRF }}
<input type="hidden" name="id" value="{{ $C.ID }}">
<input type="hidden" name="thread" value="{{ $C.Thread }}">
<input type="hidden" name="subject" value="(editing)">
<input type="hidden" name="origin" value="{{ .V.OriginURL }}">
<input type="hidden" name="body" value="{{ $C.Body }}">
<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>