mlmym/templates/sidebar.html

134 lines
5.9 KiB
HTML
Raw Normal View History

2023-06-30 19:41:35 +00:00
{{ $host := .Host }}
<div class="{{ if .User }}user {{end}}side">
<form method="GET" action="/{{.Host}}/search">
<input type="text" placeholder="search" name="q" value="">
2023-06-30 19:41:35 +00:00
{{ if .User }}
<input type="hidden" name="username" value="{{.UserName}}">
{{ else if .Community }}
2023-07-13 20:05:16 +00:00
<input type="hidden" name="communityname" value="{{fullcname .Community.CommunityView.Community}}">
2023-06-30 19:41:35 +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>
2023-09-03 16:48:04 +00:00
{{ if not .Session -}}
<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>
{{ end }}
2023-06-30 19:41:35 +00:00
{{ if .User }}
<h1>{{ .User.PersonView.Person.Name }}</h1>
2023-09-03 16:48:04 +00:00
{{ 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 }}
2023-06-30 19:41:35 +00:00
<b>{{ .User.PersonView.Counts.PostScore}}</b> post score <br>
<b>{{ .User.PersonView.Counts.CommentScore}}</b> comment score <br>
<div class="age">
{{ 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 }}
MODERATOR OF
<div class="moderators">
{{ range $i, $mod := .User.Moderates }}
<div><a href="/{{$host}}/c/{{ fullcname $mod.Community}}">{{ $mod.Community.Name }}</a></div>
{{ end }}
</div>
{{ end }}
{{ end }}
2023-07-01 02:42:45 +00:00
{{ if and .PostID .Posts }}
2023-06-30 19:41:35 +00:00
<div class="stats">
this post was submitted on {{ (index .Posts 0).Post.Published.Time.Format "01 Jan 2006" }}
<div><b><span>{{ (index .Posts 0).Counts.Score }}</span> points</b> ({{likedPerc (index .Posts 0).Counts}}% liked)</div>
</div>
{{ end }}
{{ 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 }}
2023-09-03 16:48:04 +00:00
{{ if and .Site (not .Community) (not .User) }}
2023-06-30 19:41:35 +00:00
{{ 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 }}
<div class="banner" style="background-image: url({{ .Site.SiteView.Site.Icon }})"></div>
{{ 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
2023-07-05 19:26:26 +00:00
{{ markdown .Host .Site.SiteView.Site.Sidebar.String }}
2023-06-30 19:41:35 +00:00
<div class="age" title="{{ .Site.SiteView.Site.Published.Time}}">founded {{ humanize .Site.SiteView.Site.Published.Time }}</div>
{{ if .Site.Admins }}
ADMINS
<div class="moderators">
{{ range $i, $mod := .Site.Admins }}
<div><a href="/{{$host}}/u/{{ fullname $mod.Person}}">{{ fullname $mod.Person }}</a></div>
{{ end }}
</div>
{{ end }}
{{ end }}
{{ 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 }}
<div class="banner" style="background-image: url({{ .Community.CommunityView.Community.Icon }})"></div>
{{ end }}
<h1>{{ if ne .Community.CommunityView.Community.Title ""}}{{ .Community.CommunityView.Community.Title }}{{ else }}{{ .Community.CommunityView.Community.Name }}{{end}}</h1>
{{ 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 }}">
</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>
2023-06-30 19:41:35 +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
{{ if and .Session (isMod .Community .Session.UserName) }}
<p class="gray">you are a moderator of this community</p>
{{ 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) }}
MODERATOR TOOLS
<div class="moderators">
<a href="/{{.Host}}/c/{{.CommunityName}}/edit">community settings</a>
2023-06-30 19:41:35 +00:00
</div>
{{ 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 }}
</div>