mlmym/templates/nav.html

93 lines
4.9 KiB
HTML
Raw Normal View History

2024-05-12 04:09:05 +00:00
{{- $state := . -}}
2023-06-30 19:41:35 +00:00
<nav>
<div class="communities">
2024-05-12 04:09:05 +00:00
{{- if .Session }}
<a id="openmycommunities" href="/{{.Host}}/search?searchtype=Communities&listingType=Subscribed&page=0">my communities ▼</a>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
<a href="/{{.Host}}">home</a>
<span> - </span>
2024-05-12 04:09:05 +00:00
<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>
2023-06-30 19:41:35 +00:00
</div>
2023-07-24 02:12:01 +00:00
<div id="mycommunities">
{{- if and .Session .Session.Communities }}
2024-05-12 04:09:05 +00:00
<a href="/{{.Host}}/search?searchtype=Communities&listingType=Subscribed&page=0">view all »</a>
{{- range .Session.Communities }}
<a href="/{{ $state.Host}}/{{ if .Community.Local }}c/{{.Community.Name}}{{else}}{{ localize .Community.ActorID }}{{end}}">{{fullcname .Community }}</a>
{{- end }}
{{- end -}}
2023-07-24 02:12:01 +00:00
</div>
<div class="right">
2024-05-12 04:09:05 +00:00
{{- if .Session }}
2024-05-27 18:23:53 +00:00
<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>
2024-05-12 04:09:05 +00:00
{{- else}}
2024-06-02 17:45:42 +00:00
<a href="/{{.Host}}/login">log in</a> or <a href="/{{.Host}}/login">sign up</a>
|
2023-07-10 15:53:15 +00:00
<a id="opensettings" href="/{{.Host}}/settings">settings</a>
2024-05-12 04:09:05 +00:00
{{- end}}
</div>
2023-07-10 15:53:15 +00:00
<div id="settingspopup"></div>
2023-06-30 19:41:35 +00:00
<div class="spacer">
<a href="/{{ .Host}}/">
2024-06-02 17:45:42 +00:00
<img class="icon" src="{{ if and .Site .Site.SiteView.Site.Icon.IsValid }}{{ shrink .Site.SiteView.Site.Icon.String }}{{else}}/{{ .Host}}/icon.jpg{{end}}">
2023-06-30 19:41:35 +00:00
</a>
</div>
{{- if .Community }}
2023-09-03 16:48:04 +00:00
<a class="title" href="/{{ .Host}}/c/{{fullcname .Community.CommunityView.Community}}">{{fullcname .Community.CommunityView.Community}}</a>
2023-06-30 19:41:35 +00:00
{{ else if .User }}
<a class="title" href="/{{ .Host}}/u/{{fullname .User.PersonView.Person}}">{{fullname .User.PersonView.Person}}</a>
{{ else }}
<a class="title" href="/{{.Host}}">{{ host .Host}}</a>
2023-06-30 19:41:35 +00:00
{{- end -}}
{{- if eq .Op "create_post" "create_community" -}}
<span>: submit</span>
{{- else if eq .Op "edit_post" "edit_community" -}}
<span>: edit</span>
{{ else }}
{{- if ne .Query "" -}}
<span>: search</span>
{{ end }}
<ul>
2023-09-03 16:48:04 +00:00
{{- if eq .Op "block" }}<li class="selected"><a href="/{{ .Host }}/post/{{ (index .Posts 0).Post.ID}}">block</a></li>
{{ else if and .User (not .Query)}}
<li {{if eq .Op "" }}class="selected"{{end}}><a href="?">overview</a></li>
2023-07-05 18:27:49 +00:00
{{ if and .Session (eq .User.PersonView.Person.ID .Session.UserID) }}
2023-07-05 14:20:07 +00:00
<li {{if eq .Op "Saved"}}class="selected"{{end}}><a href="?view=Saved">saved</a></li>
{{ end }}
{{ else if or .Comments .PostID -}}
2023-06-30 19:41:35 +00:00
<li class="selected"><a href="">comments</a></li>
{{ else if and .Activities (not .Query) }}
2023-06-30 19:41:35 +00:00
<li class="selected"><a href="">mailbox</a></li>
{{ else }}
<li{{ if eq .Sort "Hot" }} class="selected"{{end}}><a href="{{ .SortBy "Hot" }}">hot</a></li>
<li{{ if eq .Sort "Active" }} class="selected"{{end}}><a href="{{ .SortBy "Active" }}">active</a></li>
2023-12-17 03:22:54 +00:00
<li{{ if eq .Sort "Scaled" }} class="selected"{{end}}><a href="{{ .SortBy "Scaled" }}">scaled</a></li>
<li{{ if eq .Sort "Controversial" }} class="selected"{{end}}><a href="{{ .SortBy "Controversial" }}">controversial</a></li>
2023-06-30 19:41:35 +00:00
<li{{ if eq .Sort "Old" }} class="selected"{{end}}><a href="{{ .SortBy "Old" }}">old</a></li>
<li{{ if eq .Sort "New" }} class="selected"{{end}}><a href="{{ .SortBy "New" }}">new</a></li>
<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>
2024-05-12 04:09:05 +00:00
{{- if .Posts }}
2023-07-10 15:53:15 +00:00
<li id="showimages"><a id="se" href="">show images</a></li>
2024-05-12 04:09:05 +00:00
{{- end }}
{{- end }}
{{- if and .PostID }}{{ $post := (index .Posts 0) }}{{ if $post.CrossPosts }}
2024-04-27 19:22:57 +00:00
<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>
2024-05-12 04:09:05 +00:00
{{- end }}{{ end }}
2023-06-30 19:41:35 +00:00
</ul>
2024-05-12 04:09:05 +00:00
{{- end }}
2023-06-30 19:41:35 +00:00
</nav>