mlmym/templates/sidebar.html

130 lines
5.7 KiB
HTML
Raw Normal View History

2024-05-12 04:09:05 +00:00
{{- $host := .Host }}
2024-06-02 23:08:22 +00:00
<div class="{{ if .User }}user {{end}}side{{ if .HideSidebar }} hide{{ end }}">
2023-06-30 19:41:35 +00:00
<form method="GET" action="/{{.Host}}/search">
<input type="text" placeholder="search" name="q" value="">
2024-06-02 20:30:56 +00:00
{{- if eq .Listing "Local" }}
<input type="hidden" placeholder="search" name="listingType" value="Local">
{{- end }}
2024-05-12 04:09:05 +00:00
{{- if .User }}
2023-06-30 19:41:35 +00:00
<input type="hidden" name="username" value="{{.UserName}}">
2024-05-12 04:09:05 +00:00
{{- else if .Community }}
2023-07-13 20:05:16 +00:00
<input type="hidden" name="communityname" value="{{fullcname .Community.CommunityView.Community}}">
2024-05-12 04:09:05 +00:00
{{- end }}
2023-07-16 17:45:40 +00:00
<input type="hidden" name="sort" value="New">
2023-06-30 19:41:35 +00:00
</form>
2024-05-12 04:09:05 +00:00
{{- if not .Session -}}
2023-09-03 16:48:04 +00:00
<form class="login" method="post">
<input name="username" type="text" placeholder="username" maxlength="20">
<input name="password" type="password" placeholder="password">
<div>
<input type="submit" name="op" value="login">
</div>
</form>
2024-05-12 04:09:05 +00:00
{{- end -}}
2023-09-03 16:48:04 +00:00
2024-05-12 04:09:05 +00:00
{{- if .User }}
2023-06-30 19:41:35 +00:00
<h1>{{ .User.PersonView.Person.Name }}</h1>
2024-05-12 04:09:05 +00:00
{{- if .Session }}
2023-09-03 16:48:04 +00:00
<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>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
<div class="age">
2024-05-12 04:09:05 +00:00
{{- if .Session }}
<span class="left"><a href="/{{ $host}}/u/{{ fullname .User.PersonView.Person }}/message">send a message</a></span>
{{- end}}
2023-12-17 01:09:35 +00:00
<span title="{{ .User.PersonView.Person.Published.Time}}">joined {{ humanize .User.PersonView.Person.Published.Time }}</span>
2023-06-30 19:41:35 +00:00
</div>
2024-05-12 04:09:05 +00:00
{{- if .User.Moderates }}
2023-06-30 19:41:35 +00:00
MODERATOR OF
<div class="moderators">
2024-05-12 04:09:05 +00:00
{{- range $i, $mod := .User.Moderates }}
2023-06-30 19:41:35 +00:00
<div><a href="/{{$host}}/c/{{ fullcname $mod.Community}}">{{ $mod.Community.Name }}</a></div>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
</div>
2024-05-12 04:09:05 +00:00
{{- end }}
{{- end -}}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- if and .PostID .Posts }}
2023-06-30 19:41:35 +00:00
<div class="stats">
2023-12-17 01:09:35 +00:00
this post was submitted on {{ (index .Posts 0).Post.Published.Time.Format "02 Jan 2006" }}
2023-06-30 19:41:35 +00:00
<div><b><span>{{ (index .Posts 0).Counts.Score }}</span> points</b> ({{likedPerc (index .Posts 0).Counts}}% liked)</div>
</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 .Session }}
2023-06-30 19:41:35 +00:00
<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>
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 .Site (not .Community) (not .User) }}
2024-06-03 00:56:49 +00:00
{{- if .Site.SiteView.Site.Banner.IsValid }}
<div class="banner" style="background-image: url({{ .Site.SiteView.Site.Banner.String }})"></div>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
<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
2023-07-05 19:26:26 +00:00
{{ markdown .Host .Site.SiteView.Site.Sidebar.String }}
2023-12-17 01:09:35 +00:00
<div class="age" title="{{ .Site.SiteView.Site.Published.Time}}">founded {{ humanize .Site.SiteView.Site.Published.Time }}</div>
2024-05-12 04:09:05 +00:00
{{- if .Site.Admins }}
2023-06-30 19:41:35 +00:00
ADMINS
<div class="moderators">
2024-05-12 04:09:05 +00:00
{{- range $i, $mod := .Site.Admins }}
2023-06-30 19:41:35 +00:00
<div><a href="/{{$host}}/u/{{ fullname $mod.Person}}">{{ fullname $mod.Person }}</a></div>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
</div>
2024-05-12 04:09:05 +00:00
{{- end }}
{{- end -}}
2023-06-30 19:41:35 +00:00
2024-05-12 04:09:05 +00:00
{{- if .Community }}
2024-06-03 00:34:26 +00:00
{{- if (or .Community.CommunityView.Community.Banner.IsValid .Community.CommunityView.Community.Icon.IsValid) }}
2024-06-02 17:45:42 +00:00
<div class="banner" style="background-image: url({{ cbanner .Community.CommunityView.Community }})"></div>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
<h1>{{ if ne .Community.CommunityView.Community.Title ""}}{{ .Community.CommunityView.Community.Title }}{{ else }}{{ .Community.CommunityView.Community.Name }}{{end}}</h1>
2024-05-12 04:09:05 +00:00
{{- if .Session }}
2023-06-30 19:41:35 +00:00
<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 }}">
</form>
<form method="POST" class="block {{ if .Community.CommunityView.Blocked }}unblock{{end}}">
<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>
2024-05-12 04:09:05 +00:00
{{- end }}
<div>
{{ .Community.CommunityView.Counts.Subscribers }} readers
</div>
2023-06-30 19:41:35 +00:00
<span class="green" title="Users active in the last day"></span>
{{ .Community.CommunityView.Counts.UsersActiveDay }} users here now
2024-05-12 04:09:05 +00:00
{{- if and .Session (isMod .Community .Session.UserName) }}
2023-06-30 19:41:35 +00:00
<p class="gray">you are a moderator of this community</p>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
<p>{{ markdown .Host .Community.CommunityView.Community.Description.String }}</p>
2023-12-17 01:09:35 +00:00
<div class="age" title="{{ .Community.CommunityView.Counts.Published.Time}}">
founded {{ humanize .Community.CommunityView.Counts.Published.Time }}
2023-06-30 19:41:35 +00:00
</div>
2024-05-12 04:09:05 +00:00
{{- if and .Session (isMod .Community .Session.UserName) }}
2023-06-30 19:41:35 +00:00
MODERATOR TOOLS
<div class="moderators">
<a href="/{{.Host}}/c/{{.CommunityName}}/edit">community settings</a>
2023-06-30 19:41:35 +00:00
</div>
2024-05-12 04:09:05 +00:00
{{- end }}
{{- if .Community.Moderators }}
2023-06-30 19:41:35 +00:00
MODERATORS
<div class="moderators">
{{ range $i, $mod := .Community.Moderators }}
<div><a href="/{{$host}}/u/{{ fullname $mod.Moderator}}">{{ fullname $mod.Moderator }}</a></div>
{{ end }}
</div>
2024-05-12 04:09:05 +00:00
{{- end }}
{{- end }}
2023-06-30 19:41:35 +00:00
</div>