From 6ba418c9b2fd02b2f784c20f83bd040585689c5f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 22 Oct 2020 13:03:50 -0400 Subject: Generalize sidebar categorization logic --- themes/alps/compose.html | 13 ++----------- themes/alps/mailbox.html | 21 ++------------------- themes/alps/message.html | 28 +++------------------------- themes/alps/util.html | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 55 deletions(-) create mode 100644 themes/alps/util.html (limited to 'themes/alps') diff --git a/themes/alps/compose.html b/themes/alps/compose.html index be84b03..fe3c86a 100644 --- a/themes/alps/compose.html +++ b/themes/alps/compose.html @@ -1,18 +1,9 @@ {{template "head.html" .}} {{template "nav.html" .}} - +{{template "util.html" .}}
- + {{ template "aside" . }}
diff --git a/themes/alps/mailbox.html b/themes/alps/mailbox.html index e09f2b7..fca34ba 100644 --- a/themes/alps/mailbox.html +++ b/themes/alps/mailbox.html @@ -1,5 +1,6 @@ {{template "head.html" .}} {{template "nav.html" .}} +{{template "util.html" .}} {{ define "mbox-link" }} {{ if not (.HasAttr "\\Noselect") }} @@ -21,25 +22,7 @@ {{ end }}
- - + {{ template "aside" . }}
diff --git a/themes/alps/message.html b/themes/alps/message.html index 2926641..713d3bc 100644 --- a/themes/alps/message.html +++ b/themes/alps/message.html @@ -1,5 +1,6 @@ {{template "head.html" .}} {{template "nav.html" .}} +{{template "util.html" .}} {{define "message-part-tree"}} {{/* nested templates can't access the parent's context */}} @@ -28,31 +29,8 @@ {{end}}
- {{$current := .Mailbox}} - - + {{ $current := .Mailbox }} + {{ template "aside" . }}
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") }} + + {{- if eq .Name "INBOX" -}} + Inbox + {{- else -}} + {{ .Name }} + {{- end -}} + {{- if .HasAttr "\\HasChildren" }}/{{ end }} + + {{ if and (ne .Unseen -1) (ne .Unseen 0) }}({{ .Unseen }}){{ end }} + +{{ else }} + + {{.Name}}{{- if .HasAttr "\\HasChildren" }}/{{ end }} + +{{ end }} +{{ end }} + +{{ define "aside" }} + +{{ end }} -- cgit v1.2.3