mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-22 21:49:23 +00:00
126 lines
5.4 KiB
HTML
126 lines
5.4 KiB
HTML
<div class="comment{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted }} hidden{{end}}" id="c{{.P.Comment.ID}}">
|
|
{{ 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">
|
|
<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>
|
|
</div>
|
|
{{ end }}
|
|
<div class="meta">
|
|
<a class="minimize" href="" for="c{{.P.Comment.ID}}">
|
|
{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted }}
|
|
[+]
|
|
{{ else }}
|
|
[-]
|
|
{{ end }}
|
|
</a>
|
|
<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}}">{{fullname .P.Creator}}</a>
|
|
<b>{{.P.Counts.Score}} points</b> <span title="{{.P.Comment.Published.Time}}">{{ humanize .P.Comment.Published.Time }}</span>
|
|
{{- 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>
|
|
{{ if eq .Op "edit" }}
|
|
<div class="content">
|
|
<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">
|
|
<input name="submit" type="submit" value="save">
|
|
<input name="submit" type="submit" value="cancel">
|
|
</form>
|
|
{{ else }}
|
|
<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}}
|
|
{{ 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>
|
|
{{ 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>
|
|
<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>
|
|
{{ 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>
|
|
<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 }}
|
|
<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>
|
|
{{ end }}
|
|
</ul>
|
|
</div>
|
|
<div class="children">
|
|
{{ if and (eq .State.Op "reply") (eq .State.CommentID .P.Comment.ID)}}
|
|
<form class="savecomment" method="POST">
|
|
<div>
|
|
<textarea name="content"></textarea>
|
|
</div>
|
|
<input type="hidden" name="parentid" value="{{.P.Comment.ID}}">
|
|
<input type="hidden" name="op" value="create_comment">
|
|
<input type="submit" name="submit" value="save">
|
|
<input type="submit" name="submit" value="cancel">
|
|
</form>
|
|
{{ 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>
|