mlmym/templates/comment.html

127 lines
5.3 KiB
HTML
Raw Normal View History

2023-07-27 01:25:55 +00:00
<div class="comment{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted .P.Comment.Removed }} hidden{{end}}" id="c{{.P.Comment.ID}}">
2023-07-03 22:12:32 +00:00
{{ if .State.Session }}
<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}}">
{{- if or (lt .P.Counts.Score -5) .P.Comment.Deleted -}}
2023-06-30 19:41:35 +00:00
[+]
{{- else -}}
2023-06-30 19:41:35 +00:00
[-]
{{- end -}}
2023-06-30 19:41:35 +00:00
</a>
2023-09-03 16:48:04 +00:00
<a class="creator{{ if .P.Comment.Distinguished}}{{if .P.Creator.Admin}} admin{{end}} distinguished{{ else if .Submitter }} 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>
<div class="content">
{{ if eq .Op "edit" }}
{{ template "create_comment.html" .State }}
2023-07-03 22:12:32 +00:00
{{ else }}
{{if .P.Comment.Deleted}}
2023-07-27 01:25:55 +00:00
[deleted]
{{else if .P.Comment.Removed }}
[removed by mod]
{{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-28 21:00:58 +00:00
<li><a href="{{.P.Comment.ApID}}">fedilink</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>
2023-10-04 17:31:49 +00:00
{{ if not .P.Comment.Deleted }}
2023-07-07 16:30:07 +00:00
<li>
<form class="delete" method="POST">
<input type="hidden" name="commentid" value="{{.P.Comment.ID}}">
<input type="hidden" name="op" value="delete_comment">
2023-10-04 17:31:49 +00:00
<input type="submit" name="submit" value="delete">
2023-07-07 16:30:07 +00:00
</form>
</li>
2023-10-04 17:31:49 +00:00
{{ end }}
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">
{{ end }}
</form>
</li>
2023-09-03 16:48:04 +00:00
<li>
<form class="link-btn" method="POST">
<input type="hidden" name="commentid" value="{{.P.Comment.ID}}">
<input type="hidden" name="op" value="block_user">
<input type="hidden" name="user_id" value="{{.P.Creator.ID}}">
<input type="submit" name="submit" value="block">
</form>
</li>
2023-07-07 16:30:07 +00:00
<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 }}
{{ if and .ParentID .State.CommentID (not .State.XHR) }}
2023-07-13 13:45:51 +00:00
<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 }}
{{ 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)}}
{{ template "create_comment.html" .State }}
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>
</div>