diff options
Diffstat (limited to 'themes')
-rw-r--r-- | themes/alps/compose.html | 13 | ||||
-rw-r--r-- | themes/alps/mailbox.html | 21 | ||||
-rw-r--r-- | themes/alps/message.html | 28 | ||||
-rw-r--r-- | themes/alps/util.html | 41 |
4 files changed, 48 insertions, 55 deletions
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" .}} <div class="page-wrap"> - <aside> - <a href="/compose" class="new active">Compose Mail</a> - <!-- TODO: use mailbox list from template data --> - <a href="/mailbox/INBOX">Inbox</a> - <a href="/mailbox/Drafts">Drafts</a> - <a href="/mailbox/Sent">Sent</a> - <a href="/mailbox/Archive">Archive</a> - <a href="/mailbox/Junk">Junk</a> - <a href="/mailbox/Trash">Trash</a> - </aside> + {{ template "aside" . }} <div class="container"> <main class="create-update"> 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 }} <div class="page-wrap"> - <aside> - <!-- the logo image, dimensions 200x32 may be present or not --> - <a href="/compose" class="new">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> - + {{ template "aside" . }} <div class="container"> <form id="messages-form" method="post"></form> <main class="message-list"> 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}} <div class="page-wrap"> - {{$current := .Mailbox}} - <aside> - <!-- the logo image, dimensions 200x32 may be present or not --> - <a href="/compose" class="new">Compose Mail</a> - {{range .Mailboxes}} - <a href="{{.URL}}" - {{ if eq $current.Name .Name }}class="active"{{ end }}> - {{ if eq .Name "INBOX" }} - Inbox - {{else}} - {{.Name}} - {{end}} - - {{ $unseen := 0 }} - {{ if eq .Name "INBOX" }} - {{ $unseen = $.Inbox.Unseen }} - {{ end }} - {{ if eq .Name $.Mailbox.Name }} - {{ $unseen = $.Mailbox.Unseen }} - {{ end }} - {{ if $unseen }}({{ $unseen }}){{ end }} - </a> - {{end}} - </aside> - + {{ $current := .Mailbox }} + {{ template "aside" . }} <div class="container"> <main class="message"> <section class="actions"> 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 }} |