mlmym/templates/main.html

145 lines
6.2 KiB
HTML
Raw Normal View History

2023-06-30 19:41:35 +00:00
<!DOCTYPE html>
<head>
<title>{{if and .Posts .PostID }}{{ (index .Posts 0).Post.Name}} : {{.CommunityName}}{{else if and .Community (ne .Community.CommunityView.Community.Title "")}}{{.Community.CommunityView.Community.Title}}{{else if ne .CommunityName ""}}/c/{{.CommunityName}}{{ else if .User}}overview for {{.User.PersonView.Person.Name}}{{else}}{{ host .Host }}{{end}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
2023-06-30 19:41:35 +00:00
<link rel="shortcut icon" href="/{{.Host}}/icon.jpg">
<link rel="stylesheet" href="/_/static/style.css?v={{ .Version }}">
2024-05-11 00:53:58 +00:00
{{- if or (not .Dark) (is .Dark) }}
<link rel="stylesheet" href="/_/static/dark.css?v={{ .Version }}" {{ if not .Dark }}media="(prefers-color-scheme:dark)"{{ end }}>
{{- end }}
2023-06-30 19:41:35 +00:00
</head>
2024-05-11 00:53:58 +00:00
<body>
2023-06-30 19:41:35 +00:00
<noscript>
<link rel="stylesheet" href="/_/static/noscript.css?v={{ .Version }}">
2023-06-30 19:41:35 +00:00
</noscript>
{{ template "nav.html" . -}}
2024-05-12 04:09:05 +00:00
{{- if and (not .ShowNSFW) .Community .Community.CommunityView.Community.NSFW }}
{{ template "nsfw.html" }}
{{- else }}
2023-07-03 00:11:13 +00:00
<main>
2024-05-12 04:09:05 +00:00
{{- if or (.Query) (.SearchType) (and (not .PostID) (not .User) (not .Activities) (eq .Op ""))}}
{{ template "menu.html" . }}
{{- end}}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- if or (ne .SearchType "") (ne .Query "") .Communities }}
2023-06-30 19:41:35 +00:00
<form class="search" method="GET">
2023-07-16 17:45:40 +00:00
<input type="hidden" name="sort" value="{{.Sort}}">
<input type="hidden" name="listingType" value="{{.Listing}}">
2023-06-30 19:41:35 +00:00
<div>search</div>
<div class="query">
<input type="text" name="q" value="{{.Query}}">
<input type="submit" value="search">
</div>
<div>
<select name="searchtype">
2024-04-27 19:22:47 +00:00
<option value="All"{{ if eq .SearchType "All" }} selected{{ end }}>all</option>
2023-06-30 19:41:35 +00:00
<option value="Posts"{{ if eq .SearchType "Posts" }} selected{{ end }}>posts</option>
<option value="Comments"{{ if eq .SearchType "Comments" }} selected{{ end }}>comments</option>
2024-05-10 15:26:10 +00:00
<option value="Communities"{{ if eq .SearchType "Communities" }} selected{{ end }}>communities</option>
2024-04-27 19:22:47 +00:00
<option value="Url"{{ if eq .SearchType "Url" }} selected{{ end }}>url</option>
2023-06-30 19:41:35 +00:00
</select>
<label>from
<input type="text" placeholder="everywhere" name="communityname" value="{{.CommunityName}}"></label>
<label>by
<input type="text" placeholder="anyone" name="username" value="{{.UserName}}"></label>
</div>
</form>
2024-05-12 04:09:05 +00:00
{{- end}}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- if .Error }}
2023-07-16 02:07:19 +00:00
<div class="error">
{{.Error}}.
{{ if .Unknown }}
try remote instance: <a href="{{ .Unknown }}">{{ .Unknown }}</a>
{{ end }}
</div>
{{ end }}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- if eq .Op "create_community" "edit_community" }}
{{ template "create_community.html" . }}
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- range .Posts }}
2023-06-30 19:41:35 +00:00
{{ template "post.html" . }}
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- if eq .Op "create_post" "edit_post" }}
{{ template "create_post.html" . }}
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- if and .PostID .Posts}}
{{- if .CommentID}}
2023-06-30 19:41:35 +00:00
<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>
2024-05-12 04:09:05 +00:00
{{- else }}
2024-04-20 19:34:06 +00:00
<div id="comments" class="commentmenu">
2024-05-12 04:09:05 +00:00
{{- 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}}
2023-06-30 19:41:35 +00:00
<div>
sorted by:
<a {{ if eq .CommentSort "Hot"}}class="selected"{{end}} href="{{ .SortBy "Hot"}}">hot</a>
<a {{ if eq .CommentSort "Top"}}class="selected"{{end}} href="{{ .SortBy "Top"}}">top</a>
2023-12-17 03:22:54 +00:00
<a {{ if eq .CommentSort "Controversial"}}class="selected"{{end}} href="{{ .SortBy "Controversial"}}">controversial</a>
<a {{ if eq .CommentSort "New"}}class="selected"{{end}} href="{{ .SortBy "New"}}">new</a>
<a {{ if eq .CommentSort "Old"}}class="selected"{{end}} href="{{ .SortBy "Old"}}">old</a>
2023-06-30 19:41:35 +00:00
</div>
</div>
2024-05-12 04:09:05 +00:00
{{- if and .Session (ne .Op "edit_post") }}
<div class="create_comment">
2024-05-12 04:09:05 +00:00
{{ template "create_comment.html" . }}
</div>
2024-05-12 04:09:05 +00:00
{{- end }}
{{- end }}
{{- end}}
{{- if and .User .Activities }}
2024-05-10 15:31:20 +00:00
<div class="menu">
sorted by:
<a {{ if eq .Sort "New"}}class="selected"{{end}} href="{{ .SortBy "New"}}">new</a>
<a {{ if eq .Sort "TopAll"}}class="selected"{{end}} href="{{ .SortBy "TopAll"}}">top</a>
<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>
2024-05-10 00:55:37 +00:00
</div>
2024-05-12 04:09:05 +00:00
{{- end -}}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- range $i, $comment := .Comments }}
2023-06-30 19:41:35 +00:00
{{ template "comment.html" $comment }}
2024-05-12 04:09:05 +00:00
{{- end -}}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- 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>
2024-05-12 04:09:05 +00:00
{{- end -}}
2024-05-12 04:09:05 +00:00
{{- if eq .Op "send_message" }}
{{ template "send_message.html" . }}
2024-05-12 04:09:05 +00:00
{{- else }}
{{ template "activities.html" . }}
2024-05-12 04:09:05 +00:00
{{- end -}}
2024-05-12 04:09:05 +00:00
{{- range .Communities }}
{{ template "community.html" . }}
2024-05-12 04:09:05 +00:00
{{- end -}}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- 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>
2024-05-12 04:09:05 +00:00
{{- end -}}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- 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))) }}
2023-06-30 19:41:35 +00:00
<div class="pager">
view more: {{if gt .Page 1 }}<a href="{{ .PrevPage }}"> prev</a>{{ end }} <a href="{{ .NextPage }}">next </a>
</div>
2024-05-12 04:09:05 +00:00
{{- if not .PostID }}
2023-07-10 15:53:15 +00:00
<input id="loadmore" type="submit" value="load more" data-page="2">
2024-05-12 04:09:05 +00:00
{{- end }}
{{- end }}
<script src="/_/static/utils.js?v={{ .Version }}"></script>
2024-05-12 04:09:05 +00:00
{{- if .Watch }}
2023-07-26 20:53:06 +00:00
<script src="/_/static/ws.js"></script>
2024-05-12 04:09:05 +00:00
{{- end }}
{{- template "sidebar.html" . }}
2023-06-30 19:41:35 +00:00
</main>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
</body>
</html>