whitespace

This commit is contained in:
Ryan Stafford 2024-05-12 00:09:05 -04:00
parent 1fe8e5a5b5
commit 87a7662c94
8 changed files with 365 additions and 380 deletions

View file

@ -1,17 +1,17 @@
<div class="comment{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted .P.Comment.Removed }} hidden{{end}}" id="c{{.P.Comment.ID}}">
<div class="score">
{{ if .State.Session }}
{{- 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}}
{{- if .P.MyVote.IsValid}}
<input type="hidden" name="undo" value="{{.P.MyVote.String}}">
{{ end}}
{{- 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 }}
{{- end }}
</div>
<div class="meta">
<a class="minimize" href="" for="c{{.P.Comment.ID}}">
@ -34,34 +34,34 @@
{{ end }}
</div>
<div class="content">
{{ if eq .Op "edit" }}
{{- if eq .Op "edit" }}
{{ template "create_comment.html" .State }}
{{ else }}
{{if .P.Comment.Deleted}}
{{- else }}
{{- if .P.Comment.Deleted}}
[deleted]
{{else if .P.Comment.Removed }}
{{- else if .P.Comment.Removed }}
[removed by mod]
{{else}}
{{- 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" }}
{{- end}}
{{- if eq .Op "source" }}
<div><textarea>{{.P.Comment.Content}}</textarea></div>
{{end}}
{{ end }}
{{- 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"}}
{{- 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 }}
{{- 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") }}
{{- 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 }}
{{- if not .P.Comment.Deleted }}
<li>
<form class="delete" method="POST">
<input type="hidden" name="commentid" value="{{.P.Comment.ID}}">
@ -69,17 +69,17 @@
<input type="submit" name="submit" value="delete">
</form>
</li>
{{ end }}
{{ end }}
{{- 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 }}
{{- if .P.Saved }}
<input type="submit" name="submit" value="unsave">
{{ else }}
{{- else }}
<input type="submit" name="submit" value="save">
{{ end }}
{{- end }}
</form>
</li>
<li>
@ -95,32 +95,32 @@
reply
</a>
</li>
{{ end }}
{{ if and .ParentID .State.CommentID (not .State.XHR) }}
{{- 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) }}
{{- 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) }}
{{- 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 }}
{{- end }}
</ul>
</div>
<div class="children">
{{ if and (eq .State.Op "reply") (eq .State.CommentID .P.Comment.ID)}}
{{- if and (eq .State.Op "reply") (eq .State.CommentID .P.Comment.ID)}}
{{ template "create_comment.html" .State }}
{{ end}}
{{- end}}
{{ range $ci, $child := .C }}{{ template "comment.html" $child }}{{end}}
{{ if and (ne .P.Counts.ChildCount .ChildCount) (not .State.Activities) (not .State.Query) }}
{{- 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}}
{{- end}}
</div>
</div>

View file

@ -17,22 +17,22 @@
{{ end -}}
</textarea>
</div>
{{ if eq .Op "edit" }}
{{- if eq .Op "edit" }}
<input type="hidden" name="op" value="edit_comment">
<input type="hidden" name="commentid" value="{{.CommentID}}">
{{ else }}
{{- else }}
<input type="hidden" name="op" value="create_comment">
{{ end }}
{{- end }}
<input type="hidden" name="parentid" value="{{.CommentID}}">
<input type="submit" name="submit" value="save">
{{ if or .Op .Content }}
{{- if or .Op .Content }}
<input type="submit" name="submit" value="cancel">
{{ end }}
{{- end }}
<div class="right">
<a href="https://join-lemmy.org/docs/users/02-media.html" target="_blank">formatting help</a>
<input name="submit" type="submit" value="preview">
</div>
{{ if .Content }}
{{- if .Content }}
<div class="preview">
<div class="comment">
<h3>Preview</h3>
@ -41,5 +41,5 @@
</div>
</div>
</div>
{{ end }}
{{- end }}
</form>

View file

@ -12,18 +12,18 @@
<noscript>
<link rel="stylesheet" href="/_/static/noscript.css?v={{ .Version }}">
</noscript>
{{ template "nav.html" . -}}
{{ if and (not .ShowNSFW) .Community .Community.CommunityView.Community.NSFW }}
{{- if and (not .ShowNSFW) .Community .Community.CommunityView.Community.NSFW }}
{{ template "nsfw.html" }}
{{ else }}
{{- else }}
<main>
{{ if and (not .Community) .Tagline }}
<h3>{{ markdown .Host .Tagline }}</h3>
{{ end }}
{{- if and (not .Community) .Tagline }}
<h3>
{{ markdown .Host .Tagline }}
</h3>
{{- end }}
{{ template "menu.html" . }}
{{ if .Error }}
{{- if .Error }}
<div class="error">
{{.Error}}.
{{ if .Unknown }}
@ -32,16 +32,14 @@
</div>
{{ end }}
{{ range .Posts }}
{{- range .Posts }}
{{ template "post.html" . }}
{{ end }}
{{ if or (and (not .Op) (not .Activities) (not .Comments) (not .Posts) (not .Communities)) (and (not .Comments) .PostID) (and (not .Activities) (not .Query) .User) }}
{{- if or (and (not .Op) (not .Activities) (not .Comments) (not .Posts) (not .Communities)) (and (not .Comments) .PostID) (and (not .Activities) (not .Query) .User) }}
<div class="error">there doesn't seem to be anything here</div>
{{ end }}
{{ if or .Query (eq .SearchType "Communities") (eq (len .Posts) 25) (and .Comments (and (eq .CommentCount 200) (gt (index .Posts 0).Counts.Comments .CommentCount))) (and .User (or (gt .User.PersonView.Counts.CommentCount 10) (gt .User.PersonView.Counts.PostCount 10))) }}
{{- if or .Query (eq .SearchType "Communities") (eq (len .Posts) 25) (and .Comments (and (eq .CommentCount 200) (gt (index .Posts 0).Counts.Comments .CommentCount))) (and .User (or (gt .User.PersonView.Counts.CommentCount 10) (gt .User.PersonView.Counts.PostCount 10))) }}
<div class="pager">
view more: {{if gt .Page 1 }}<a href="{{ .PrevPage }}"> prev</a>{{ end }} <a href="{{ .NextPage }}">next </a>
</div>

View file

@ -12,17 +12,16 @@
<noscript>
<link rel="stylesheet" href="/_/static/noscript.css?v={{ .Version }}">
</noscript>
{{ template "nav.html" . -}}
{{ if and (not .ShowNSFW) .Community .Community.CommunityView.Community.NSFW }}
{{- if and (not .ShowNSFW) .Community .Community.CommunityView.Community.NSFW }}
{{ template "nsfw.html" }}
{{ else }}
{{- else }}
<main>
{{ if or (.Query) (.SearchType) (and (not .PostID) (not .User) (not .Activities) (eq .Op ""))}}
{{- if or (.Query) (.SearchType) (and (not .PostID) (not .User) (not .Activities) (eq .Op ""))}}
{{ template "menu.html" . }}
{{ end}}
{{- end}}
{{ if or (ne .SearchType "") (ne .Query "") .Communities }}
{{- if or (ne .SearchType "") (ne .Query "") .Communities }}
<form class="search" method="GET">
<input type="hidden" name="sort" value="{{.Sort}}">
<input type="hidden" name="listingType" value="{{.Listing}}">
@ -45,9 +44,9 @@
<input type="text" placeholder="anyone" name="username" value="{{.UserName}}"></label>
</div>
</form>
{{ end}}
{{- end}}
{{ if .Error }}
{{- if .Error }}
<div class="error">
{{.Error}}.
{{ if .Unknown }}
@ -56,26 +55,26 @@
</div>
{{ end }}
{{ if eq .Op "create_community" "edit_community" }}
{{- if eq .Op "create_community" "edit_community" }}
{{ template "create_community.html" . }}
{{ end }}
{{- end }}
{{ range .Posts }}
{{- range .Posts }}
{{ template "post.html" . }}
{{ end }}
{{- end }}
{{ if eq .Op "create_post" "edit_post" }}
{{- if eq .Op "create_post" "edit_post" }}
{{ template "create_post.html" . }}
{{ end }}
{{- end }}
{{ if and .PostID .Posts}}
{{ if .CommentID}}
{{- if and .PostID .Posts}}
{{- if .CommentID}}
<div class="warning">you are viewing a single comment's thread<br>
<a href="../post/{{.PostID}}/#c{{.CommentID}}">view the rest of the comments</a>
</div>
{{ else }}
{{- else }}
<div id="comments" class="commentmenu">
{{if .Comments}}{{if gt .Page 1}}(page {{ .Page }}) {{else if lt (index .Posts 0).Counts.Comments .CommentCount }}all{{else}}top{{end}} {{.CommentCount}} comments{{else}} no comments (yet){{end}}
{{- if .Comments}}{{if gt .Page 1}}(page {{ .Page }}) {{else if lt (index .Posts 0).Counts.Comments .CommentCount }}all{{else}}top{{end}} {{.CommentCount}} comments{{else}} no comments (yet){{end}}
<div>
sorted by:
<a {{ if eq .CommentSort "Hot"}}class="selected"{{end}} href="{{ .SortBy "Hot"}}">hot</a>
@ -85,14 +84,14 @@
<a {{ if eq .CommentSort "Old"}}class="selected"{{end}} href="{{ .SortBy "Old"}}">old</a>
</div>
</div>
{{ if and .Session (ne .Op "edit_post") }}
{{- if and .Session (ne .Op "edit_post") }}
<div class="create_comment">
{{ template "create_comment.html" . }}
</div>
{{ end }}
{{ end }}
{{ end}}
{{ if and .User .Activities }}
{{- end }}
{{- end }}
{{- end}}
{{- if and .User .Activities }}
<div class="menu">
sorted by:
<a {{ if eq .Sort "New"}}class="selected"{{end}} href="{{ .SortBy "New"}}">new</a>
@ -100,48 +99,46 @@
<a {{ if eq .Sort "Controversial"}}class="selected"{{end}} href="{{ .SortBy "Controversial"}}">controversial</a>
<a {{ if eq .Sort "Old"}}class="selected"{{end}} href="{{ .SortBy "Old"}}">old</a>
</div>
{{ end }}
{{- end -}}
{{ range $i, $comment := .Comments }}
{{- range $i, $comment := .Comments }}
{{ template "comment.html" $comment }}
{{ end }}
{{- end -}}
{{ if and .Comments .Posts (gt (index .Posts 0).Counts.Comments .CommentCount) (not .CommentID)}}
{{- if and .Comments .Posts (gt (index .Posts 0).Counts.Comments .CommentCount) (not .CommentID)}}
<div class="morecomments">
<a id="lmc" href="" data-page="2">load more comments</a>
</div>
{{ end }}
{{- end -}}
{{ if eq .Op "send_message" }}
{{- if eq .Op "send_message" }}
{{ template "send_message.html" . }}
{{ else }}
{{- else }}
{{ template "activities.html" . }}
{{ end }}
{{- end -}}
{{ range .Communities }}
{{- range .Communities }}
{{ template "community.html" . }}
{{ end }}
{{- end -}}
{{ if or (and (not .Op) (not .Activities) (not .Comments) (not .Posts) (not .Communities)) (and (not .Comments) .PostID) (and (not .Activities) (not .Query) .User) }}
{{- if or (and (not .Op) (not .Activities) (not .Comments) (not .Posts) (not .Communities)) (and (not .Comments) .PostID) (and (not .Activities) (not .Query) .User) }}
<div class="error">there doesn't seem to be anything here</div>
{{ end }}
{{- end -}}
{{ if or .Query (eq .SearchType "Communities") (eq (len .Posts) 25) (and .Comments (gt (index .Posts 0).Counts.Comments .CommentCount) (not .CommentID)) (and .User (or (gt .User.PersonView.Counts.CommentCount 10) (gt .User.PersonView.Counts.PostCount 10))) }}
{{- if or .Query (eq .SearchType "Communities") (eq (len .Posts) 25) (and .Comments (gt (index .Posts 0).Counts.Comments .CommentCount) (not .CommentID)) (and .User (or (gt .User.PersonView.Counts.CommentCount 10) (gt .User.PersonView.Counts.PostCount 10))) }}
<div class="pager">
view more: {{if gt .Page 1 }}<a href="{{ .PrevPage }}"> prev</a>{{ end }} <a href="{{ .NextPage }}">next </a>
</div>
{{ if not .PostID }}
{{- if not .PostID }}
<input id="loadmore" type="submit" value="load more" data-page="2">
{{ end }}
{{ end }}
{{- end }}
{{- end }}
<script src="/_/static/utils.js?v={{ .Version }}"></script>
{{ if .Watch }}
{{- if .Watch }}
<script src="/_/static/ws.js"></script>
{{ end }}
{{ template "sidebar.html" . }}
{{- end }}
{{- template "sidebar.html" . }}
</main>
{{ end }}
{{- end }}
</body>
</html>

View file

@ -3,11 +3,11 @@
<a href="{{ .ListBy "All"}}" {{if eq .Listing "All"}}class="selected"{{end}}>all</a>
<span>-</span>
<a href="{{ .ListBy "Local"}}" {{if eq .Listing "Local"}}class="selected"{{end}}>local</a>
{{ if .Session }}
{{- if .Session }}
<span>-</span>
<a href="{{ .ListBy "Subscribed"}}" {{if eq .Listing "Subscribed"}}class="selected"{{end}}>subscribed</a>
{{ end }}
{{ if contains .Sort "Top" }}
{{- end }}
{{- if contains .Sort "Top" }}
links from past:
<a {{ if eq .Sort "TopHour"}}class="selected"{{end}} href="{{ .SortBy "TopHour"}}">1h</a>
<span>-</span>
@ -25,5 +25,4 @@
<span>-</span>
<a {{ if eq .Sort "TopAll"}}class="selected"{{end}} href="{{ .SortBy "TopAll"}}">all time</a>
{{ end }}
</div>

View file

@ -1,44 +1,38 @@
{{ $state := . }}
{{- $state := . -}}
<nav>
<div class="communities">
{{ if .Session }}
{{- if .Session }}
<a id="openmycommunities" href="/{{.Host}}/search?searchtype=Communities&listingType=Subscribed&page=0">my communities ▼</a>
{{ end }}
{{- end }}
<a href="/{{.Host}}">home</a>
<span> - </span>
<a href="/{{.Host}}?listingType=All">all</a>
|
{{ $host := .Host }}
{{ range $i, $c := .TopCommunities}}
{{ if or (ne $state.Listing "Local") $c.Community.Local }}
<a href="/{{$host}}/c/{{fullcname $c.Community}}">{{$c.Community.Name}}</a>
<span> - </span>
{{ end }}
{{ end }}
<a href="/{{.Host}}?listingType=All">all</a>|
{{- $host := .Host -}}
{{- range $i, $c := .TopCommunities}}
{{- if or (ne $state.Listing "Local") $c.Community.Local }}
<a href="/{{$host}}/c/{{fullcname $c.Community}}">{{$c.Community.Name}}</a><span> - </span>
{{- end }}
{{- end }}
<a href="/{{$host}}/search?searchtype=Communities&sort=TopAll{{ if eq .Listing "Local" }}&listingType=Local{{end}}" class="more">more »</a>
</div>
<div id="mycommunities">
{{- if and .Session .Session.Communities }}
<a href="/{{.Host}}/search?searchtype=Communities&listingType=Subscribed&page=0">view all »</a>
{{ range .Session.Communities }}
{{- range .Session.Communities }}
<a href="/{{ $state.Host}}/{{ if .Community.Local }}c/{{.Community.Name}}{{else}}{{ localize .Community.ActorID }}{{end}}">{{fullcname .Community }}</a>
{{ end }}
{{ end -}}
{{- end }}
{{- end -}}
</div>
<div class="right">
{{ if .Session }}
<a href="/{{.Host}}/u/{{ .Session.UserName}}">{{ .Session.UserName }}</a>
|
<a href="/{{.Host}}/inbox" class="mailbox{{ if .UnreadCount }} orangered{{end}}"></a>
|
<a id="opensettings" href="/{{.Host}}/settings">settings</a>
|
{{- if .Session }}
<a href="/{{.Host}}/u/{{ .Session.UserName}}">{{ .Session.UserName }}</a>|
<a href="/{{.Host}}/inbox" class="mailbox{{ if .UnreadCount }} orangered{{end}}"></a>|
<a id="opensettings" href="/{{.Host}}/settings">settings</a>|
<form method="POST"><input type="submit" name="op" value="logout"></form>
{{else}}
<a href="/{{.Host}}/login">log in</a> or <a href="/{{.Host}}/login">sign up</a>
|
{{- else}}
<a href="/{{.Host}}/login">log in</a> or <a href="/{{.Host}}/login">sign up</a>|
<a id="opensettings" href="/{{.Host}}/settings">settings</a>
{{end}}
{{- end}}
</div>
<div id="settingspopup"></div>
<div class="spacer">
@ -82,14 +76,13 @@
<li{{ if eq .Sort "MostComments" }} class="selected"{{end}}><a href="{{ .SortBy "MostComments" }}">most comments</a></li>
<li{{ if eq .Sort "NewComments" }} class="selected"{{end}}><a href="{{ .SortBy "NewComments" }}">new comments</a></li>
<li{{ if contains .Sort "Top" }} class="selected"{{end}}><a href="{{ .SortBy "TopDay" }}">top</a></li>
{{ if .Posts }}
{{- if .Posts }}
<li id="showimages"><a id="se" href="">show images</a></li>
{{ end }}
{{ end }}
{{ if and .PostID }}{{ $post := (index .Posts 0) }}{{ if $post.CrossPosts }}
{{- end }}
{{- end }}
{{- if and .PostID }}{{ $post := (index .Posts 0) }}{{ if $post.CrossPosts }}
<li><a href="/{{.Host}}/search?q={{ $post.Post.URL.String }}&searchtype=Url{{ if not $post.Post.Local }}&listingType=All{{end}}">other discussions ({{ $post.CrossPosts }})</a></li>
{{ end }}{{ end }}
{{- end }}{{ end }}
</ul>
{{ end }}
{{- end }}
</nav>

View file

@ -1,15 +1,15 @@
{{ if and (ne .State.Op "vote_post") (ne .State.Op "save_post") }}
{{- 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}}" id="p{{.Post.ID}}">
{{ if gt .Rank 0 }}
{{- if gt .Rank 0 }}
<div class="rank"> {{ .Rank }} </div>
{{ end }}
{{- end }}
<div class="score">
{{ end }}
{{ if or (ne .State.Op "save_post") (eq .State.Op "vote_post") }}
{{ if .State.Session }}
{{- 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}}
{{- if .MyVote.IsValid}}
<input type="hidden" name="undo" value="{{.MyVote.String}}">
{{ end}}
<input type="hidden" name="op" value="vote_post">
@ -17,26 +17,24 @@
<div>{{ .Counts.Score }}</div>
<input type="submit" name="vote" value="▼">
</form>
{{ else }}
{{- else }}
<div style="margin-top: 19px;">{{ .Counts.Score }}</div>
{{ end }}
{{ end }}
{{ if and (ne .State.Op "vote_post") (ne .State.Op "save_post") }}
{{- 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 }}>
<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="entry">
<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 }}>
<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 . }})
@ -66,66 +64,67 @@
</a>
</div>
<div class="buttons">
{{ if .Post.NSFW }}<span class="nsfw">NSFW</span>{{end}}
{{- 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 }}
{{- if .State.Session }}
<a href="/{{ .State.Host }}/post/{{ .Post.ID }}/block" rel="xhr" target="block{{ .Post.ID }}">block</a>
{{ end }}
{{- end }}
<span class="blockpopup" name="block{{.Post.ID}}"></span>
{{ 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}}
{{- 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 }}
{{- if .Post.Deleted }}
<input type="submit" value="undelete">
<input type="hidden" name="undo" value="1">
{{ else }}
{{- else }}
<input type="submit" value="delete">
{{ end }}
{{- end }}
</form>
{{ end}}
{{ end }}
{{ if or (ne .State.Op "vote_post") (eq .State.Op "save_post") }}
{{ if .State.Session }}
{{- 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 }}
{{- if .PostView.Saved }}
<input type="submit" name="submit" value="unsave">
{{ else }}
{{- else }}
<input type="submit" name="submit" value="save">
{{ end }}
{{- end }}
</form>
{{end}}
{{ end }}
{{ if and (ne .State.Op "vote_post") (ne .State.Op "save_post") }}
{{ if .State.PostID }}
{{- 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) }}
{{- 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 }}
{{- if .Post.Deleted }}
<input type="submit" name="submit" value="mark unread">
{{ else }}
{{- else }}
<input type="submit" name="submit" value="mark read">
{{ end }}
{{- end }}
</form>
{{ end }}
{{- end }}
</div>
<div class="expando{{ if eq .Rank 0 }} open{{ end}}">
{{ if (and .Post.Body.IsValid (ne .Post.Body.String "")) }}
{{- if (and .Post.Body.IsValid (ne .Post.Body.String "")) }}
<div class="md">{{ markdown .State.Host .Post.Body.String }}</div>
{{ end }}
{{ if isImage .Post.URL.String}}
{{- end }}
{{- if isImage .Post.URL.String}}
<img class="image" loading="lazy" src="{{ .Post.URL }}">
{{ end }}
{{- end }}
<div class="embed"></div>
</div>
</div>
<div class="clearleft"></div>
</div>
{{ end }}
{{- end -}}

View file

@ -1,17 +1,15 @@
{{ $host := .Host }}
{{- $host := .Host }}
<div class="{{ if .User }}user {{end}}side">
<form method="GET" action="/{{.Host}}/search">
<input type="text" placeholder="search" name="q" value="">
{{ if .User }}
{{- if .User }}
<input type="hidden" name="username" value="{{.UserName}}">
{{ else if .Community }}
{{- else if .Community }}
<input type="hidden" name="communityname" value="{{fullcname .Community.CommunityView.Community}}">
{{ end }}
{{- end }}
<input type="hidden" name="sort" value="New">
</form>
{{ if not .Session -}}
{{- if not .Session -}}
<form class="login" method="post">
<input name="username" type="text" placeholder="username" maxlength="20">
<input name="password" type="password" placeholder="password">
@ -19,79 +17,80 @@
<input type="submit" name="op" value="login">
</div>
</form>
{{ end }}
{{- end -}}
{{ if .User }}
{{- if .User }}
<h1>{{ .User.PersonView.Person.Name }}</h1>
{{ if .Session }}
{{- if .Session }}
<div>
<form method="POST" class="block {{ if .UserBlocked }}unblock{{end}}">
<input name="submit" type="submit" value="{{ if .UserBlocked}}unblock{{else}}block{{end}}">
<input type="hidden" name="op" value="block_user">
</form>
</div>
{{ end }}
{{- end }}
<div class="age">
{{ if .Session }}<span class="left"><a href="/{{ $host}}/u/{{ fullname .User.PersonView.Person }}/message">send a message</a></span>{{end}}
{{- if .Session }}
<span class="left"><a href="/{{ $host}}/u/{{ fullname .User.PersonView.Person }}/message">send a message</a></span>
{{- end}}
<span title="{{ .User.PersonView.Person.Published.Time}}">joined {{ humanize .User.PersonView.Person.Published.Time }}</span>
</div>
{{ if .User.Moderates }}
{{- if .User.Moderates }}
MODERATOR OF
<div class="moderators">
{{ range $i, $mod := .User.Moderates }}
{{- range $i, $mod := .User.Moderates }}
<div><a href="/{{$host}}/c/{{ fullcname $mod.Community}}">{{ $mod.Community.Name }}</a></div>
{{ end }}
{{- end }}
</div>
{{ end }}
{{ end }}
{{- end }}
{{- end -}}
{{ if and .PostID .Posts }}
{{- if and .PostID .Posts }}
<div class="stats">
this post was submitted on {{ (index .Posts 0).Post.Published.Time.Format "02 Jan 2006" }}
<div><b><span>{{ (index .Posts 0).Counts.Score }}</span> points</b> ({{likedPerc (index .Posts 0).Counts}}% liked)</div>
</div>
{{ end }}
{{- end -}}
{{ if .Session }}
{{- if .Session }}
<div class="create">
<a href="/{{$host}}/create_post{{ if .Community }}?communityname={{.CommunityName}}{{ end }}"><div>Create a post »</div></a>
{{ if not .Community }}
<a href="/{{$host}}/create_community"><div>Create a community »</div></a>
{{ end }}
</div>
{{ end }}
{{- end -}}
{{ if and .Site (not .Community) (not .User) }}
{{ if .Site.SiteView.Site.Banner.IsValid }}
{{- if and .Site (not .Community) (not .User) }}
{{- if .Site.SiteView.Site.Banner.IsValid }}
<div class="banner" style="background-image: url({{ .Site.SiteView.Site.Banner }})"></div>
{{ else if .Site.SiteView.Site.Icon.IsValid }}
{{- else if .Site.SiteView.Site.Icon.IsValid }}
<div class="banner" style="background-image: url({{ .Site.SiteView.Site.Icon }})"></div>
{{ end }}
{{- end }}
<h1>{{ .Site.SiteView.Site.Name }}</h1>
{{ printer .Site.SiteView.Counts.Users }} readers <br>
<span class="green" title="Users active in the last day"></span>
{{ printer .Site.SiteView.Counts.UsersActiveDay }} users here now
{{ markdown .Host .Site.SiteView.Site.Sidebar.String }}
<div class="age" title="{{ .Site.SiteView.Site.Published.Time}}">founded {{ humanize .Site.SiteView.Site.Published.Time }}</div>
{{ if .Site.Admins }}
{{- if .Site.Admins }}
ADMINS
<div class="moderators">
{{ range $i, $mod := .Site.Admins }}
{{- range $i, $mod := .Site.Admins }}
<div><a href="/{{$host}}/u/{{ fullname $mod.Person}}">{{ fullname $mod.Person }}</a></div>
{{ end }}
{{- end }}
</div>
{{ end }}
{{ end }}
{{- end }}
{{- end -}}
{{ if .Community }}
{{ if .Community.CommunityView.Community.Banner.IsValid }}
{{- if .Community }}
{{- if .Community.CommunityView.Community.Banner.IsValid }}
<div class="banner" style="background-image: url({{ .Community.CommunityView.Community.Banner }})"></div>
{{ else if .Community.CommunityView.Community.Icon.IsValid }}
{{- else if .Community.CommunityView.Community.Icon.IsValid }}
<div class="banner" style="background-image: url({{ .Community.CommunityView.Community.Icon }})"></div>
{{ end }}
{{- end }}
<h1>{{ if ne .Community.CommunityView.Community.Title ""}}{{ .Community.CommunityView.Community.Title }}{{ else }}{{ .Community.CommunityView.Community.Name }}{{end}}</h1>
{{ if .Session }}
{{- if .Session }}
<form method="POST" class="member {{ membership .Community.CommunityView.Subscribed }}">
<input name="op" type="submit" value="{{ membership .Community.CommunityView.Subscribed}}">
<input name="communityid" type="hidden" value="{{ .Community.CommunityView.Community.ID }}">
@ -100,32 +99,32 @@
<input name="op" type="submit" value="{{ if .Community.CommunityView.Blocked}}unblock{{else}}block{{end}}">
<input name="communityid" type="hidden" value="{{ .Community.CommunityView.Community.ID }}">
</form>
{{ end }}
{{- end }}
<div>
{{ .Community.CommunityView.Counts.Subscribers }} readers
</div>
<span class="green" title="Users active in the last day"></span>
{{ .Community.CommunityView.Counts.UsersActiveDay }} users here now
{{ if and .Session (isMod .Community .Session.UserName) }}
{{- if and .Session (isMod .Community .Session.UserName) }}
<p class="gray">you are a moderator of this community</p>
{{ end }}
{{- end }}
<p>{{ markdown .Host .Community.CommunityView.Community.Description.String }}</p>
<div class="age" title="{{ .Community.CommunityView.Counts.Published.Time}}">
founded {{ humanize .Community.CommunityView.Counts.Published.Time }}
</div>
{{ if and .Session (isMod .Community .Session.UserName) }}
{{- if and .Session (isMod .Community .Session.UserName) }}
MODERATOR TOOLS
<div class="moderators">
<a href="/{{.Host}}/c/{{.CommunityName}}/edit">community settings</a>
</div>
{{ end }}
{{ if .Community.Moderators }}
{{- end }}
{{- if .Community.Moderators }}
MODERATORS
<div class="moderators">
{{ range $i, $mod := .Community.Moderators }}
<div><a href="/{{$host}}/u/{{ fullname $mod.Moderator}}">{{ fullname $mod.Moderator }}</a></div>
{{ end }}
</div>
{{ end }}
{{ end }}
{{- end }}
{{- end }}
</div>