2023-07-10 15:53:15 +00:00
|
|
|
<div class="comment{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted }} hidden{{end}}" id="c{{.P.Comment.ID}}">
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ if .State.Session }}
|
2023-07-02 21:29:35 +00:00
|
|
|
<div class="score">
|
|
|
|
<form class="link-btn{{ if eq .P.MyVote.String "1"}} like{{ else if eq .P.MyVote.String "-1"}} dislike{{end}}" method="POST">
|
2023-07-05 14:20:07 +00:00
|
|
|
<input type="submit" name="submit" value="▲">
|
2023-06-30 19:41:35 +00:00
|
|
|
<div></div>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ if .P.MyVote.IsValid}}
|
2023-06-30 19:41:35 +00:00
|
|
|
<input type="hidden" name="undo" value="{{.P.MyVote.String}}">
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ end}}
|
2023-06-30 19:41:35 +00:00
|
|
|
<input type="hidden" name="op" value="vote_comment">
|
|
|
|
<input type="hidden" name="commentid" value="{{.P.Comment.ID }}">
|
2023-07-05 14:20:07 +00:00
|
|
|
<input type="submit" name="submit" value="▼">
|
2023-06-30 19:41:35 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ end }}
|
2023-07-10 15:53:15 +00:00
|
|
|
<div class="meta">
|
2023-06-30 19:41:35 +00:00
|
|
|
<a class="minimize" href="" for="c{{.P.Comment.ID}}">
|
2023-07-03 22:12:32 +00:00
|
|
|
{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted }}
|
2023-06-30 19:41:35 +00:00
|
|
|
[+]
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ else }}
|
2023-06-30 19:41:35 +00:00
|
|
|
[-]
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ end }}
|
2023-06-30 19:41:35 +00:00
|
|
|
</a>
|
2023-07-14 13:55:42 +00:00
|
|
|
<a {{ if .P.Comment.Distinguished}}class="{{if .P.Creator.Admin}}admin {{end}}distinguished"{{ else if .Submitter }}class="submitter"{{end}} href="/{{.State.Host}}/u/{{fullname .P.Creator}}">
|
|
|
|
{{- if .State.HideInstanceNames -}}
|
|
|
|
{{ .P.Creator.Name }}
|
|
|
|
{{- else -}}
|
|
|
|
{{ fullname .P.Creator }}
|
|
|
|
{{- end -}}
|
|
|
|
</a>
|
2023-07-07 16:30:07 +00:00
|
|
|
<b>{{.P.Counts.Score}} points</b> <span title="{{.P.Comment.Published.Time}}">{{ humanize .P.Comment.Published.Time }}</span>
|
2023-06-30 19:41:35 +00:00
|
|
|
{{- if gt .P.Comment.Updated.Time.Unix .P.Comment.Published.Time.Unix -}}
|
|
|
|
* (last edited <span title="{{.P.Comment.Updated.Time}}">{{ humanize .P.Comment.Updated.Time }}</span>)
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ if eq .Op "edit" }}
|
2023-07-08 20:51:42 +00:00
|
|
|
<div class="content">
|
2023-06-30 19:41:35 +00:00
|
|
|
<form class="savecomment" method="POST">
|
|
|
|
<div>
|
|
|
|
<textarea required name="content">{{ .P.Comment.Content }}</textarea>
|
|
|
|
</div>
|
|
|
|
<input type="hidden" name="commentid" value="{{.P.Comment.ID}}">
|
|
|
|
<input type="hidden" name="op" value="edit_comment">
|
2023-07-08 20:51:42 +00:00
|
|
|
<input name="submit" type="submit" value="save">
|
|
|
|
<input name="submit" type="submit" value="cancel">
|
2023-06-30 19:41:35 +00:00
|
|
|
</form>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ else }}
|
2023-07-08 20:51:42 +00:00
|
|
|
<div class="content">
|
|
|
|
{{if .P.Comment.Deleted}}
|
|
|
|
[removed]
|
|
|
|
{{else}}
|
|
|
|
<div {{ if and .Selected (not .State.XHR) (ne .State.Op "reply")}}class="highlight" {{end}}>
|
|
|
|
{{ markdown .State.Host .P.Comment.Content }}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ if eq .Op "source" }}
|
2023-07-07 16:30:07 +00:00
|
|
|
<div><textarea>{{.P.Comment.Content}}</textarea></div>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{end}}
|
|
|
|
{{ end }}
|
2023-07-07 16:30:07 +00:00
|
|
|
<ul class="buttons">
|
|
|
|
<li><a href="/{{.State.Host}}/comment/{{.P.Comment.ID}}">permalink</a></li>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ if ne .Op "source"}}
|
2023-07-07 16:30:07 +00:00
|
|
|
<li><a class="source" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?source">source</a></li>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ else }}
|
2023-07-07 16:30:07 +00:00
|
|
|
<li><a class="source" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?">hide source</a></li>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ end }}
|
|
|
|
{{ if .State.Session }}
|
2023-07-05 14:20:07 +00:00
|
|
|
{{ if and (eq .P.Comment.CreatorID .State.Session.UserID) (ne .Op "edit") }}
|
2023-07-07 16:30:07 +00:00
|
|
|
<li><a class="edit" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?edit">edit</a></li>
|
|
|
|
<li>
|
|
|
|
<form class="delete" method="POST">
|
|
|
|
<input type="hidden" name="commentid" value="{{.P.Comment.ID}}">
|
|
|
|
<input type="hidden" name="op" value="delete_comment">
|
|
|
|
<input type="submit" value="delete">
|
|
|
|
</form>
|
|
|
|
</li>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ end }}
|
2023-07-07 16:30:07 +00:00
|
|
|
<li>
|
|
|
|
<form class="link-btn" method="POST">
|
|
|
|
<input type="hidden" name="commentid" value="{{.P.Comment.ID}}">
|
|
|
|
<input type="hidden" name="op" value="save_comment">
|
|
|
|
{{ if .P.Saved }}
|
|
|
|
<input type="submit" name="submit" value="unsave">
|
|
|
|
{{ else }}
|
|
|
|
<input type="submit" name="submit" value="save">
|
2023-07-05 14:20:07 +00:00
|
|
|
|
2023-07-07 16:30:07 +00:00
|
|
|
{{ end }}
|
|
|
|
</form>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a class="reply" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?reply">
|
|
|
|
reply
|
|
|
|
</a>
|
|
|
|
</li>
|
2023-07-05 19:26:26 +00:00
|
|
|
{{ end }}
|
2023-07-13 13:45:51 +00:00
|
|
|
{{ if and .ParentID .State.CommentID }}
|
|
|
|
<li>
|
|
|
|
<a href="/{{.State.Host}}/comment/{{.ParentID}}">parent</a>
|
|
|
|
</li>
|
|
|
|
{{ end }}
|
|
|
|
{{ if and .ParentID (or .State.Activities .State.Query) }}
|
|
|
|
<li>
|
|
|
|
<a href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?context=3">context</a>
|
|
|
|
</li>
|
|
|
|
{{ end }}
|
2023-07-13 22:24:03 +00:00
|
|
|
{{ if and .State.PostID (gt (add .P.Counts.ChildCount .ChildCount) 0) }}
|
|
|
|
<li><a class="hidechildren" for="c{{.P.Comment.ID}}" href=""><span class="hide">hide</span><span class="show">show {{add .P.Counts.ChildCount .ChildCount }}</span> child comments</a></li>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ end }}
|
2023-07-07 16:30:07 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
2023-06-30 19:41:35 +00:00
|
|
|
<div class="children">
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ if and (eq .State.Op "reply") (eq .State.CommentID .P.Comment.ID)}}
|
2023-06-30 19:41:35 +00:00
|
|
|
<form class="savecomment" method="POST">
|
|
|
|
<div>
|
2023-07-08 20:51:42 +00:00
|
|
|
<textarea name="content"></textarea>
|
2023-06-30 19:41:35 +00:00
|
|
|
</div>
|
|
|
|
<input type="hidden" name="parentid" value="{{.P.Comment.ID}}">
|
|
|
|
<input type="hidden" name="op" value="create_comment">
|
2023-07-08 20:51:42 +00:00
|
|
|
<input type="submit" name="submit" value="save">
|
|
|
|
<input type="submit" name="submit" value="cancel">
|
2023-06-30 19:41:35 +00:00
|
|
|
</form>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{ end}}
|
2023-06-30 19:41:35 +00:00
|
|
|
{{ range $ci, $child := .C }}{{ template "comment.html" $child }}{{end}}
|
2023-07-13 13:45:51 +00:00
|
|
|
{{ if and (ne .P.Counts.ChildCount .ChildCount) (not .State.Activities) (not .State.Query) }}
|
2023-07-10 15:53:15 +00:00
|
|
|
<div class="morecomments">
|
|
|
|
<a class="loadmore" for="c{{ .P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?">load more comments</a>
|
|
|
|
<span class="gray">({{ sub .P.Counts.ChildCount .ChildCount}} replies)</span>
|
|
|
|
</div>
|
2023-07-03 22:12:32 +00:00
|
|
|
{{end}}
|
2023-07-10 15:53:15 +00:00
|
|
|
</div>
|
2023-06-30 19:41:35 +00:00
|
|
|
</div>
|