mlmym/templates/comment.html
2024-06-21 20:19:22 -04:00

138 lines
6.3 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="comment{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted .P.Comment.Removed }} hidden{{end}}{{ if .State.CollapseMedia}} collapse{{ end }}" id="c{{.P.Comment.ID}}">
<div class="score">
{{- if .State.Session }}
<form class="link-btn{{ if eq .P.MyVote.String "1"}} like{{ else if eq .P.MyVote.String "-1"}} dislike{{end}}" method="POST">
<input type="submit" name="submit" value="▲">
<div></div>
{{- if .P.MyVote.IsValid}}
<input type="hidden" name="undo" value="{{.P.MyVote.String}}">
{{- end}}
<input type="hidden" name="op" value="vote_comment">
<input type="hidden" name="commentid" value="{{.P.Comment.ID }}">
<input type="submit" name="submit" value="▼">
</form>
{{- end }}
</div>
<div class="meta">
<a class="minimize" href="" for="c{{.P.Comment.ID}}">
{{- if or (lt .P.Counts.Score -5) .P.Comment.Deleted .P.Comment.Removed -}}
[+]
{{- else -}}
[]
{{- end -}}
</a>
<a class="creator{{ if .P.Comment.Distinguished}}{{if false}} 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>
<b>{{.P.Counts.Score}} points</b> <span title="{{.P.Comment.Published.Time}}">{{ humanize .P.Comment.Published.Time }}</span>
{{- if gt .P.Comment.Updated.ValueOrZero.Time.Unix .P.Comment.Published.Time.Unix -}}
* (last edited <span title="{{.P.Comment.Updated.ValueOrZero.Time}}">{{ humanize .P.Comment.Updated.ValueOrZero.Time }}</span>)
{{ end }}
{{ if .P.Counts.ChildCount }}
<span class="numChildren">({{ .P.Counts.ChildCount }} children)</span>
{{ end }}
</div>
<div class="content">
{{- if eq .Op "edit" }}
{{ template "create_comment.html" .State }}
{{- else }}
{{- if .P.Comment.Deleted}}
[deleted]
{{- else if .P.Comment.Removed }}
[removed by mod]
{{- else}}
<div {{ if and .Selected (not .State.XHR) (ne .State.Op "reply")}}class="highlight" {{end}}>
{{ if .State.CollapseMedia }}
{{ collapsemedia (markdown .State.Host .P.Comment.Content) }}
{{ else }}
{{ markdown .State.Host .P.Comment.Content }}
{{ end }}
</div>
{{- end}}
{{- if eq .Op "source" }}
<div><textarea>{{.P.Comment.Content}}</textarea></div>
{{- end}}
{{- end }}
<ul class="buttons">
<li><a href="/{{.State.Host}}/comment/{{.P.Comment.ID}}">permalink</a></li>
<li><a href="{{.P.Comment.ApID}}">fedilink</a></li>
{{- if ne .Op "source"}}
<li><a class="source" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?source">source</a></li>
{{- else }}
<li><a class="source" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?">hide source</a></li>
{{- end }}
{{- if .State.Session }}
{{- if and (eq .P.Comment.CreatorID .State.Session.UserID) (ne .Op "edit") }}
<li><a class="edit" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?edit">edit</a></li>
{{- if not .P.Comment.Deleted }}
<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" name="submit" value="delete">
</form>
</li>
{{- end }}
{{- end }}
<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>
<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>
<li>
<a href="/{{ .State.Host }}/comment/{{ .P.Comment.ID }}/block" rel="xhr" target="block{{ .P.Comment.ID }}">block</a>
<span class="blockpopup" name="block{{.P.Comment.ID}}"></span>
</li>
<li>
<a class="reply" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?reply">
reply
</a>
</li>
{{- end }}
{{- if and .ParentID .State.CommentID (not .State.XHR) }}
<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>hide</span><span class="show">show {{add .P.Counts.ChildCount .ChildCount }}</span> child comments</a></li>
{{- end }}
</ul>
</div>
<div class="children">
{{- if and (eq .State.Op "reply") (eq .State.CommentID .P.Comment.ID)}}
{{ template "create_comment.html" .State }}
{{- end}}
{{ range $ci, $child := .C }}{{ template "comment.html" $child }}{{end}}
{{- if and (ne .P.Counts.ChildCount .ChildCount) (not .State.Activities) (not .State.Query) }}
<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>
{{- end}}
</div>
</div>