From 72ae9b3f63ddbe296f3e4e8f8db2d29303163d68 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Sun, 1 May 2022 22:06:03 +0200 Subject: use more tag helpers in templates --- templates/_pagination2.html.ep | 19 ++++++++------- templates/error.html.ep | 9 +++++--- templates/headers/_display_bot_nav.html.ep | 32 +++++++++++--------------- templates/headers/_display_headers.html.ep | 37 ++++++++++++++++-------------- templates/headers/_display_top_nav.html.ep | 13 ++++++----- templates/headers/_displayfolders.html.ep | 18 ++++++++++----- templates/layouts/mainlayout.html.ep | 19 ++++++++------- templates/webmail/about.html.ep | 4 ++-- templates/webmail/noaction.html.ep | 10 ++++---- templates/webmail/writemail.html.ep | 20 ++++++++-------- 10 files changed, 98 insertions(+), 83 deletions(-) (limited to 'templates') diff --git a/templates/_pagination2.html.ep b/templates/_pagination2.html.ep index f838841..e03dbb0 100644 --- a/templates/_pagination2.html.ep +++ b/templates/_pagination2.html.ep @@ -1,19 +1,22 @@ <%= l('first') . ' ' . l 'page' %>\ - <%= l('previous') . ' ' . l 'page' %> \ + <%= l('previous') . ' ' . l 'page' %> -
- [ - - <%= l 'of' %> <%= $total_pages %>] +%= form_for '' => begin + [ + %= label_for custompage => ucfirst l 'page' + %= number_field start => (id => 'custompage') => (size => 3) => (placeholder => $current_page) + %= l 'of' + %= $total_pages + ] % my $h = $c->req->query_params->to_hash; % while (my ($k, $v) = each %$h) { % if ($k ne 'start') { - + %= hidden_field $k => $v % } % } -
\ +% end <%= l('next') . ' ' . l 'page' %> \ - <%= l('last') . ' ' . l('page') %> \ No newline at end of file + <%= l('last') . ' ' . l('page') %> diff --git a/templates/error.html.ep b/templates/error.html.ep index 92391d6..d120e69 100644 --- a/templates/error.html.ep +++ b/templates/error.html.ep @@ -1,3 +1,4 @@ + @@ -8,20 +9,22 @@

Error

% if (my $msg = stash 'error') { -%= $msg + %= $msg % } % else { Uwu :( % }

+ % if (my $see_other = stash 'links') { See: % } - \ No newline at end of file + diff --git a/templates/headers/_display_bot_nav.html.ep b/templates/headers/_display_bot_nav.html.ep index 107ac67..ea1ce3c 100644 --- a/templates/headers/_display_bot_nav.html.ep +++ b/templates/headers/_display_bot_nav.html.ep @@ -12,34 +12,30 @@ - - + : + -
- - - + %= form_for move => (id => 'move-mail') => begin + %= label_for 'select-folder' => l('move') . ' ' . l('to') + %= select_field folder => [grep {$_ ne $folder} @$mail_folders] => (id => 'select-folder') %= csrf_field - - -
+ %= submit_button l 'move' + % end - \ No newline at end of file + diff --git a/templates/headers/_display_headers.html.ep b/templates/headers/_display_headers.html.ep index d3f9457..c278a37 100644 --- a/templates/headers/_display_headers.html.ep +++ b/templates/headers/_display_headers.html.ep @@ -2,11 +2,11 @@ % my $param = shift; - + %= link_to url_with->query(sort => $param eq (param('sort') || '') ? '!' . $param : $param) => begin % no warnings qw(experimental::smartmatch); %= do { given (param('sort')) { '↑' when ($param); '↓' when ('!' . $param) } } %= ucfirst l $param; - + % end % end @@ -25,25 +25,28 @@ - <%= ucfirst l 'nr' %> + + %= ucfirst l 'nr' + %= $sort_param->('status'); %= $sort_param->('date'); - % if ($folder ne "SENT") { %= $sort_param->('sender'); - % } else { + % } + % else { - - <%= ucfirst l 'recipient' %> - % if (param('sort') eq "sender") { - v - % } elsif (param('sort') eq "recipient_rev") { - ^ - % } - + %= link_to url_with->query(sort => param('sort') ne '!sender' ? 'sender' : '!sender' ) => begin + %= ucfirst l 'recipient' + % if (param('sort') eq "sender") { + %= image '/down.gif' => (width => 12) => (height => 12) => (border => 0) => (alt => 'v') + % } + % elsif (param('sort') eq "recipient_rev") { + %= image '/up.gif' => (width => 12) => (height => 12) => (border => 0) => (alt => '^') + % } + % end % } @@ -63,7 +66,7 @@ % foreach my $msgnum ($first_item .. $last_item) { % my $msg = $msgs->[$msgnum - $first_item]; - + %= tag tr => (class => $msg->{new} ? 'new-mail' : '') => (id => $msg->{mid}) => begin %= $msgnum @@ -78,15 +81,15 @@ %= $msg->{head}{from}[0]{name} || $msg->{head}{from}[0]{email}; - <%= $msg->{head}{subject} || '_' %> + %= link_to $msg->{head}{subject} || '_' => read => {id => $msg->{mid}} %= print_sizes10 $msg->{size}; - + %= check_box mail => $msg->{mid} => (form => 'move-mail') - + % end % } diff --git a/templates/headers/_display_top_nav.html.ep b/templates/headers/_display_top_nav.html.ep index 5888cb3..2b882af 100644 --- a/templates/headers/_display_top_nav.html.ep +++ b/templates/headers/_display_top_nav.html.ep @@ -6,18 +6,19 @@ %# <%= TXT 'userconfig' %> %# <%= TXT 'addressbook' %>
  • - <%= ucfirst l 'logout' %> + %= link_to ucfirst(l 'logout') => 'logout'
  • - <%= ucfirst l 'compose' %> + %= link_to ucfirst(l 'compose') => 'write'
  • -
    - : -
    + %= form_for '' => begin + %= label_for search => ucfirst(l 'search') . ': ' + %= search_field search => (size => 8) + % end @@ -30,4 +31,4 @@ - \ No newline at end of file + diff --git a/templates/headers/_displayfolders.html.ep b/templates/headers/_displayfolders.html.ep index 8cff0ed..7bc5b12 100644 --- a/templates/headers/_displayfolders.html.ep +++ b/templates/headers/_displayfolders.html.ep @@ -2,25 +2,31 @@ - <%= l($folder) || $folder %> + + %= l($folder) || $folder + - <%= $first_item %>-<%= $last_item %> <%= l 'of' %> <%= $total_items %> <%= l 'messages' %>\ - <%= ", $total_new_mails " . l('new') if $total_new_mails > 0; =%> + <%= "$first_item - $last_item " . l('of') . " $total_items " . l('messages') %>\ + <%= ", $total_new_mails " . l('new') if $total_new_mails > 0 =%> % if ($total_size) { - - <%= ucfirst l('mbox_size') . ": " . print_sizes10 $total_size %> + - <%= ucfirst(l 'mbox_size') . ": " . print_sizes10 $total_size %> % } - \ No newline at end of file + diff --git a/templates/layouts/mainlayout.html.ep b/templates/layouts/mainlayout.html.ep index 782bcdd..9f36006 100644 --- a/templates/layouts/mainlayout.html.ep +++ b/templates/layouts/mainlayout.html.ep @@ -1,21 +1,24 @@ - - <%= stash('title') || 'JWebmail' %> - + + %= stash('title') || 'JWebmail' + + %= stylesheet '/style.css' %= content diff --git a/templates/webmail/about.html.ep b/templates/webmail/about.html.ep index 49ecc1a..60fe549 100644 --- a/templates/webmail/about.html.ep +++ b/templates/webmail/about.html.ep @@ -47,7 +47,7 @@
  • Supported languages:

    % foreach (@$languages) { - <%= $_ %> + %= link_to $_ => {lang => $_} % }

  • @@ -64,7 +64,7 @@ diff --git a/templates/webmail/noaction.html.ep b/templates/webmail/noaction.html.ep index 54a8106..2608bda 100644 --- a/templates/webmail/noaction.html.ep +++ b/templates/webmail/noaction.html.ep @@ -18,12 +18,12 @@ -
    + %= form_for login => (name => 'login1') => begin
    - : + %= label_for userid => ucfirst l 'userid' %= text_field 'userid' @@ -31,7 +31,7 @@
    - : + %= label_for password => ucfirst l 'passwd' %= password_field 'password' @@ -39,12 +39,12 @@
    - + %= submit_button l 'login'
    -
    + % end diff --git a/templates/webmail/writemail.html.ep b/templates/webmail/writemail.html.ep index ca69994..8375bdf 100644 --- a/templates/webmail/writemail.html.ep +++ b/templates/webmail/writemail.html.ep @@ -8,40 +8,40 @@

    <%= $msg %>

    % } -
    +%= form_for '' => (method => 'post') => (enctype => 'multipart/form-data') => (id => 'write-form') => begin - + %= label_for mail => ucfirst l 'send_to' %= email_field 'to', id => 'mail', multiple => '', required => ''
    - + %= label_for subject => ucfirst l 'subject' %= text_field 'subject', 'required' => ''
    - + %= label_for cc => 'CC' %= email_field 'cc', 'multiple' => ''
    - + %= label_for bcc => 'BCC' %= email_field 'bcc', 'multiple' => ''
    - + %= label_for back_to => ucfirst l 'answer_to' %= email_field 'back_to'
    - - %= text_area 'body', cols => 80, rows => 24, id => 'txt' + %= label_for txt => ucfirst l 'content' + %= text_area body => (cols => 80) => (rows => 24) => (id => 'txt')
    %= file_field 'attach'
    - + %= submit_button l 'send' %= csrf_field -
    +% end