diff options
author | Drew DeVault <sir@cmpwn.com> | 2020-10-22 13:03:50 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-10-22 13:03:50 -0400 |
commit | 6ba418c9b2fd02b2f784c20f83bd040585689c5f (patch) | |
tree | 454569141bed36edf968d952f9fe04c5d08037bc /themes/alps/util.html | |
parent | 9e2c420461cef709811ac84f958fae20b93b800b (diff) | |
download | alps-6ba418c9b2fd02b2f784c20f83bd040585689c5f.tar.gz alps-6ba418c9b2fd02b2f784c20f83bd040585689c5f.zip |
Generalize sidebar categorization logic
Diffstat (limited to 'themes/alps/util.html')
-rw-r--r-- | themes/alps/util.html | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/themes/alps/util.html b/themes/alps/util.html new file mode 100644 index 0000000..68736f1 --- /dev/null +++ b/themes/alps/util.html @@ -0,0 +1,41 @@ +{{ define "mbox-link" }} +{{ if not (.HasAttr "\\Noselect") }} +<a href="{{.URL}}" {{ if .Active }}class="active"{{ end }}> + {{- if eq .Name "INBOX" -}} + Inbox + {{- else -}} + {{ .Name }} + {{- end -}} + {{- if .HasAttr "\\HasChildren" }}/{{ end }} + + {{ if and (ne .Unseen -1) (ne .Unseen 0) }}({{ .Unseen }}){{ end }} +</a> +{{ else }} +<span class="noselect"> + {{.Name}}{{- if .HasAttr "\\HasChildren" }}/{{ end }} +</span> +{{ end }} +{{ end }} + +{{ define "aside" }} +<aside> + <!-- the logo image, dimensions 200x32 may be present or not --> + <a href="/compose" class="new + {{ if eq $.GlobalData.URL.Path "/compose" }}active{{ end }} + ">Compose Mail</a> + {{ with .CategorizedMailboxes }} + {{ with .Common.Inbox }}{{ template "mbox-link" . }}{{ end}} + {{ with .Common.Drafts }}{{ template "mbox-link" . }}{{ end}} + {{ with .Common.Sent }}{{ template "mbox-link" . }}{{ end}} + {{ with .Common.Junk }}{{ template "mbox-link" . }}{{ end}} + {{ with .Common.Trash }}{{ template "mbox-link" . }}{{ end}} + {{ with .Common.Archive }}{{ template "mbox-link" . }}{{ end}} + {{ if .Additional }} + <hr /> + {{ range .Additional }} + {{ template "mbox-link" . }} + {{ end }} + {{ end }} + {{ end }} +</aside> +{{ end }} |