diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-03-10 13:54:57 +0100 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-03-10 13:54:57 +0100 |
commit | fcf5549584b69e62b6c2f0eb919f6799c7904211 (patch) | |
tree | e5f0e480af0f39f1c0f457ea0aca8d33f8fb4d0b /templates | |
parent | df59f9dec32d7f8f08706fd3eb5b784deaa0abfc (diff) |
Proper recursive rendering of mails to html
1. Added raw mode to model
2. Added raw route
3. Moved readmail view parts to RenderMail plugin
4. Renamed displayheaders partial templates
Diffstat (limited to 'templates')
-rw-r--r-- | templates/displayheaders/_bot_nav.html.ep (renamed from templates/headers/_display_bot_nav.html.ep) | 2 | ||||
-rw-r--r-- | templates/displayheaders/_folders.html.ep (renamed from templates/headers/_display_folders.html.ep) | 0 | ||||
-rw-r--r-- | templates/displayheaders/_main_table.html.ep (renamed from templates/headers/_display_headers.html.ep) | 2 | ||||
-rw-r--r-- | templates/displayheaders/_pagination1.html.ep (renamed from templates/headers/_pagination1.html.ep) | 0 | ||||
-rw-r--r-- | templates/displayheaders/_pagination2.html.ep (renamed from templates/headers/_pagination2.html.ep) | 0 | ||||
-rw-r--r-- | templates/displayheaders/_top_nav.html.ep (renamed from templates/headers/_display_top_nav.html.ep) | 2 | ||||
-rw-r--r-- | templates/exception_.html.ep (renamed from templates/error.html.ep) | 8 | ||||
-rw-r--r-- | templates/webmail/displayheaders.html.ep | 8 | ||||
-rw-r--r-- | templates/webmail/readmail.html.ep | 89 |
9 files changed, 12 insertions, 99 deletions
diff --git a/templates/headers/_display_bot_nav.html.ep b/templates/displayheaders/_bot_nav.html.ep index 9dc808a..3eb57d3 100644 --- a/templates/headers/_display_bot_nav.html.ep +++ b/templates/displayheaders/_bot_nav.html.ep @@ -1,7 +1,7 @@ <div class="pure-g jwm-nav"> <div class="pure-u-3-4 pure-u-md-1-4"> - %= include 'headers/_pagination1' + %= include 'displayheaders/_pagination1' </div> <div class="pure-u-1-4 pure-u-md-1-4"> diff --git a/templates/headers/_display_folders.html.ep b/templates/displayheaders/_folders.html.ep index be5bdd9..be5bdd9 100644 --- a/templates/headers/_display_folders.html.ep +++ b/templates/displayheaders/_folders.html.ep diff --git a/templates/headers/_display_headers.html.ep b/templates/displayheaders/_main_table.html.ep index 6c00d0b..5430c15 100644 --- a/templates/headers/_display_headers.html.ep +++ b/templates/displayheaders/_main_table.html.ep @@ -76,7 +76,7 @@ <!-- <div class="pure-u-1-4"> - %= ucfirst($msg->{head}{mime}{content_maintype} eq 'multipart' ? l('yes') : l('no')); + %# ucfirst($msg->{head}{mime}{content_maintype} eq 'multipart' ? l('yes') : l('no')); </div> --> diff --git a/templates/headers/_pagination1.html.ep b/templates/displayheaders/_pagination1.html.ep index 798f79f..798f79f 100644 --- a/templates/headers/_pagination1.html.ep +++ b/templates/displayheaders/_pagination1.html.ep diff --git a/templates/headers/_pagination2.html.ep b/templates/displayheaders/_pagination2.html.ep index 8bff0bf..8bff0bf 100644 --- a/templates/headers/_pagination2.html.ep +++ b/templates/displayheaders/_pagination2.html.ep diff --git a/templates/headers/_display_top_nav.html.ep b/templates/displayheaders/_top_nav.html.ep index ca5001b..fd6bae6 100644 --- a/templates/headers/_display_top_nav.html.ep +++ b/templates/displayheaders/_top_nav.html.ep @@ -23,7 +23,7 @@ </div> <div class="pure-u-1-1 pure-u-md-1-2"> - %= include 'headers/_pagination2'; + %= include 'displayheaders/_pagination2'; </div> <!-- delete button diff --git a/templates/error.html.ep b/templates/exception_.html.ep index 3a1d5e3..a605aaf 100644 --- a/templates/error.html.ep +++ b/templates/exception_.html.ep @@ -10,7 +10,7 @@ <h1>Error</h1> <p class=center> % if (my $msg = stash 'error') { - %= $msg +%= $msg % } % else { Uwu :( @@ -20,10 +20,10 @@ % if (my $see_other = stash 'links') { See: <nav> - % for (@$see_other) { - %= link_to $_ => $_ +% for (@$see_other) { +%= link_to $_ => $_ <br> - % } +% } </nav> % } </body> diff --git a/templates/webmail/displayheaders.html.ep b/templates/webmail/displayheaders.html.ep index 23f48d3..3f650c0 100644 --- a/templates/webmail/displayheaders.html.ep +++ b/templates/webmail/displayheaders.html.ep @@ -2,7 +2,7 @@ <div id=displayheaders> - %= include 'headers/_display_folders'; + %= include 'displayheaders/_folders'; % if (my $loginmessage = stash 'loginmessage') { <p id=loginmessage> @@ -10,10 +10,10 @@ </p> % } - %= include 'headers/_display_top_nav'; + %= include 'displayheaders/_top_nav'; % if (@$msgs) { - %= include 'headers/_display_headers'; + %= include 'displayheaders/_main_table'; % } % else { <p id=empty-folder> @@ -21,6 +21,6 @@ </p> % } - %= include 'headers/_display_bot_nav'; + %= include 'displayheaders/_bot_nav'; </div> diff --git a/templates/webmail/readmail.html.ep b/templates/webmail/readmail.html.ep index e1f299d..5bdc27e 100644 --- a/templates/webmail/readmail.html.ep +++ b/templates/webmail/readmail.html.ep @@ -1,98 +1,11 @@ % layout 'mainlayout'; -% my $mail_fmt = begin -% my ($category, $value) = @_; -% if (ref $value eq 'ARRAY' && $value->@*) { - <dt> <%= uc l $category %> </dt> -% for ($value->@*) { - <dd> -%= $_->{display_name} ? qq("$_->{display_name}" <$_->{address}>) : "$_->{address}" - </dd> -% } -% } -% end - - -% my $format_mail = begin -% my ($msg) = @_; -% my $body = $msg->{body}; -% my $content_type = to_mime_type $msg->{head}{mime}; - - <div clas="jwm-mail"> - - <dl class="jwm-mail-header"> - <dt> <%= uc l 'subject' %> </dt> - <dd> <%= $msg->{head}{subject} %> </dd> -%= $mail_fmt->(from => $msg->{head}{from}) -%= $mail_fmt->(to => $msg->{head}{to}) -%= $mail_fmt->(cc => $msg->{head}{cc}) -%= $mail_fmt->(bcc => $msg->{head}{bcc}) - <dt> <%= uc l 'date' %> </dt> - <dd> <%= $msg->{head}{date} %> </dd> - <dt> <%= uc l 'content-type' %> </dt> - <dd> <%= $content_type %> </dd> - </dl> - -% if ($content_type eq 'multipart/alternative') { -% my $end; -% for (reverse $body->{parts}->@*) { -% if (!$end) { - <div class="jwm-mail-body <%= to_mime_type($_->{head}) eq 'text/plain' ? 'jwm-mail-body-text-plain' : '' %>" > -% my $x = mime_render(to_mime_type($_->{head}), $_->{body}); -%== $x; - </div> -% $end = 1 if $x; -% } -% else { - <details class="jwm-mail-body <%= to_mime_type($_->{head}) eq 'text/plain' ? 'jwm-mail-body-text-plain' : '' %>" > - <summary> -%= to_mime_type $_->{head} - </summary> -%== mime_render(to_mime_type($_->{head}), $_->{body}) - </details> -% } -% } -% } -% elsif ($msg->{head}{mime}{content_maintype} eq 'multipart') { -% for ($body->{parts}->@*) { -% if ( !$_->{head}{content_disposition} -% || lc $_->{head}{content_disposition} eq 'none' -% || lc $_->{head}{content_disposition} eq 'inline') { - <div class="jwm-mail-body <%= to_mime_type($_->{head}) eq 'text/plain' ? 'jwm-mail-body-text-plain' : '' %>" > -%== mime_render(to_mime_type($_->{head}), $_->{body}) // "Can not render mime-part of type <code>$_->{head}{content_maintype}/$_->{head}{content_subtype}</code>." - </div> -% } -% elsif (lc $_->{head}{content_disposition} eq 'attachment') { - <p> - Attachment <%= $_->{head}{filename} %> of type -%= to_mime_type $_->{head} - </p> -% } -% else { -% die "unknown Content-Disposition '$_->{head}{content_disposition}'" -% } -% } -% } -% elsif ($msg->{head}{mime}{content_maintype} eq 'message') { -% die "not implemented" unless $msg->{head}{mime}{content_subtype} eq 'rfc822'; - <p>not implemented</p> -% } -% else { - <div class="jwm-mail-body <%= $content_type eq 'text/plain' ? 'jwm-mail-body-text-plain' : '' %>" > -%== mime_render($content_type, $body) // $content_type - </div> -% } - - </div> -% end - - <div class="jwm-base"> <h1>Read Mail</h1> -%= $format_mail->($msg) +%= $c->render_mail->format_mail($msg) <nav> <a href="javascript:history.back()" class="pure-button"> |