mirror of
https://github.com/rystaf/mlmym.git
synced 2024-12-29 03:53:46 +00:00
152 lines
7.2 KiB
HTML
152 lines
7.2 KiB
HTML
{{- if and (ne .State.Op "vote_post") (ne .State.Op "save_post") -}}
|
|
<div class="post{{if .Post.Deleted}} deleted{{end}}{{ if .Post.FeaturedCommunity }} distinguished{{end}}{{if .Post.FeaturedLocal }} announcement{{end}}{{ if and (eq .Rank 0) (.State.CollapseMedia) }} collapse{{end}}" id="p{{.Post.ID}}">
|
|
{{- if gt .Rank 0 }}
|
|
<div class="rank"> {{ .Rank }} </div>
|
|
{{- end }}
|
|
<div class="p">
|
|
<div class="score">
|
|
{{- end }}
|
|
{{- if or (ne .State.Op "save_post") (eq .State.Op "vote_post") }}
|
|
{{- if .State.Session }}
|
|
<form class="link-btn {{ if lt .Rank 1 }}squish{{end}}{{ if eq .MyVote.String "1" }} like{{else if eq .MyVote.String "-1"}} dislike{{end}}" method="POST">
|
|
<input type="submit" name="vote" value="▲">
|
|
{{- if .MyVote.IsValid}}
|
|
<input type="hidden" name="undo" value="{{.MyVote.String}}">
|
|
{{ end}}
|
|
<input type="hidden" name="op" value="vote_post">
|
|
<input type="hidden" name="postid" value="{{.Post.ID }}">
|
|
<div>{{ .Counts.Score }}</div>
|
|
<input type="submit" name="vote" value="▼">
|
|
</form>
|
|
{{- else }}
|
|
<div><div>{{ .Counts.Score }}</div></div>
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if and (ne .State.Op "vote_post") (ne .State.Op "save_post") }}
|
|
</div>
|
|
{{ if not .State.HideThumbnails }}
|
|
<div class="thumb">
|
|
<a class="url" href="{{ if .Post.URL.IsValid }}{{ .Post.URL }}{{ else }}/{{ .State.Host }}/post/{{ .Post.ID }}{{ end }}"
|
|
{{- if .State.LinksInNewWindow }} target="_blank" {{ end }}>
|
|
<div {{ if and .Post.NSFW (not (and .State.Community .State.Community.CommunityView.Community.NSFW))}}class="img-blur"{{end}}style="background-image: url({{thumbnail .Post}})"></div>
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
<div class="title{{ if .Read}} visited{{end}}">
|
|
<a class="url" href="{{ if .Post.URL.IsValid }}{{ .Post.URL }}{{ else }}/{{ .State.Host }}/post/{{ .Post.ID }}{{ end }}"
|
|
{{- if .State.LinksInNewWindow }} target="_blank" {{ end }}>
|
|
{{ rmmarkdown .Post.Name }}
|
|
</a>
|
|
({{ domain . }})
|
|
</div>
|
|
<div class="entry">
|
|
<div class="expando-button{{ if and (not (and .Post.Body.IsValid .Post.Body.String )) (not (isImage .Post.URL.String)) (not (isYoutube .Post.URL.String)) }} hidden{{else if and (eq .Rank 0) (not .State.CollapseMedia)}} open{{ end }}"></div>
|
|
<div>
|
|
<div class="meta">
|
|
<span>
|
|
submitted
|
|
<span title="{{.Post.Published.Time}}">{{ humanize .Post.Published.Time -}}</span></span>
|
|
{{- if gt .Post.Updated.ValueOrZero.Time.Unix .Post.Published.Time.Unix -}}
|
|
<span>* (last edited <span title="{{.Post.Updated.ValueOrZero.Time}}">{{ humanize .Post.Updated.ValueOrZero.Time }}</span>)</span>
|
|
{{ end }}
|
|
<span>by
|
|
<a class="submitter{{ if false}} admin{{end}}" href="/{{ .State.Host }}/u/{{ fullname .Creator }}">
|
|
{{- if .State.HideInstanceNames -}}
|
|
{{ .Creator.Name }}
|
|
{{- else -}}
|
|
{{ fullname .Creator }}
|
|
{{- end -}}
|
|
</a></span>
|
|
<span>to
|
|
<a class="community" href="/{{ .State.Host }}/c/{{ fullcname .Community }}">
|
|
c/{{ if .State.HideInstanceNames -}}
|
|
{{ .Community.Name }}
|
|
{{ else -}}
|
|
{{ fullcname .Community }}
|
|
{{ end }}
|
|
</a></span>
|
|
</div>
|
|
<div class="buttons">
|
|
{{- if .Post.NSFW }}
|
|
<span class="nsfw">NSFW</span>{{end}}
|
|
<a href="/{{ .State.Host }}/post/{{ .Post.ID }}">{{ .Counts.Comments }} comments</a>
|
|
<a href="{{ .Post.ApID}}">fedilink</a>
|
|
{{- if .State.Session }}
|
|
<a href="/{{ .State.Host }}/post/{{ .Post.ID }}/block" rel="xhr" target="block{{ .Post.ID }}">block</a>
|
|
<span class="blockpopup" name="block{{.Post.ID}}"></span>
|
|
{{- end }}
|
|
{{- if and .State.Session (eq .State.Session.UserID .Post.CreatorID) }}
|
|
{{- if not .Post.Deleted }}<a href="/{{ .State.Host }}/post/{{ .Post.ID }}?edit">edit</a>{{end}}
|
|
<form class="link-btn" method="POST">
|
|
<input type="hidden" name="postid" value="{{.Post.ID }}">
|
|
<input type="hidden" name="op" value="delete_post">
|
|
{{- if .Post.Deleted }}
|
|
<input type="submit" value="undelete">
|
|
<input type="hidden" name="undo" value="1">
|
|
{{- else }}
|
|
<input type="submit" value="delete">
|
|
{{- end }}
|
|
</form>
|
|
{{- end}}
|
|
{{- end }}
|
|
{{- if or (ne .State.Op "vote_post") (eq .State.Op "save_post") }}
|
|
{{- if .State.Session }}
|
|
<form class="link-btn" method="POST">
|
|
<input type="hidden" name="postid" value="{{.Post.ID }}">
|
|
<input type="hidden" name="op" value="save_post">
|
|
{{- if .PostView.Saved }}
|
|
<input type="submit" name="submit" value="unsave">
|
|
{{- else }}
|
|
<input type="submit" name="submit" value="save">
|
|
{{- end }}
|
|
</form>
|
|
{{- end}}
|
|
{{- end }}
|
|
{{- if and (ne .State.Op "vote_post") (ne .State.Op "save_post") }}
|
|
{{- if .State.PostID }}
|
|
<a id="hidechildren" class="scripting" href="">hide all child comments</a>
|
|
{{- end }}
|
|
{{- if and .State.Site .State.Site.MyUser.IsValid (not .State.Site.MyUser.ValueOrZero.LocalUserView.LocalUser.ShowReadPosts) }}
|
|
<form class="link-btn" method="POST">
|
|
<input type="hidden" name="postid" value="{{.Post.ID }}">
|
|
<input type="hidden" name="op" value="read_post">
|
|
{{- if .Post.Deleted }}
|
|
<input type="submit" name="submit" value="mark unread">
|
|
{{- else }}
|
|
<input type="submit" name="submit" value="mark read">
|
|
{{- end }}
|
|
</form>
|
|
{{- end }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="expando{{ if and (eq .Rank 0) (not .State.CollapseMedia)}} open{{ end}}{{ if and (not .Post.Body.IsValid) (not (isImage .Post.URL.String))}} hide{{end}}{{ if and .Post.Body.IsValid (ne .Post.Body.String "") }} text{{end}}">
|
|
{{- if or ((and .Post.Body.IsValid (ne .Post.Body.String ""))) (isImage .Post.URL.String)}}
|
|
{{- if gt .Rank 0 }}
|
|
<div class="rank"> </div>
|
|
{{- end }}
|
|
<div class="score"><div><div> </div></div></div>
|
|
{{ if not .State.HideThumbnails }}
|
|
<div class="thumb"></div>
|
|
{{ end }}
|
|
{{- end }}
|
|
<div>
|
|
{{- if (and .Post.Body.IsValid (ne .Post.Body.String "")) }}
|
|
<div class="md">
|
|
{{ if .State.CollapseMedia }}
|
|
{{ collapsemedia (markdown .State.Host .Post.Body.String) }}
|
|
{{ else }}
|
|
{{ markdown .State.Host .Post.Body.String }}
|
|
{{ end }}
|
|
</div>
|
|
{{- end }}
|
|
{{- if isImage .Post.URL.String}}
|
|
<img class="image" loading="lazy" src="{{ .Post.URL }}">
|
|
{{- end }}
|
|
<div class="embed"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{- end -}}
|