summaryrefslogtreecommitdiff
path: root/templates/headers
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de>2022-05-01 22:06:03 +0200
committerJannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de>2022-05-01 22:06:03 +0200
commit72ae9b3f63ddbe296f3e4e8f8db2d29303163d68 (patch)
treef0db960b784719df0c7318720880c73b5330b937 /templates/headers
parent7c8bd21ccbca8a3166289ab0e5511cc82d2822aa (diff)
use more tag helpers in templates
Diffstat (limited to 'templates/headers')
-rw-r--r--templates/headers/_display_bot_nav.html.ep32
-rw-r--r--templates/headers/_display_headers.html.ep37
-rw-r--r--templates/headers/_display_top_nav.html.ep13
-rw-r--r--templates/headers/_displayfolders.html.ep18
4 files changed, 53 insertions, 47 deletions
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 @@
</td>
<td>
- <label for=allbox><%= l 'check_all' %>: </label>
- <input name=allbox type=checkbox onclick="check_all(this);">
+ <label for=allbox><%= l 'check_all' %></label>:
+ <input name=allbox type=checkbox onclick="check_all(this)">
</td>
<td>
- <form id=move-mail action="<%= url_for('move') %>" method=post>
- <label for=select-folder> <%= l('move') . ' ' . l('to') %> </label>
- <select name=folder id=select-folder>
- %== "<option value='$_'>$_</option>" for grep {$_ ne $folder} @$mail_folders;
- </select>
-
+ %= 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
-
- <input type="submit" value="<%= l 'move' %>">
- </form>
+ %= submit_button l 'move'
+ % end
</td>
</tr>
</table>
-<script>
+<script type="text/javascript">
function check_all(box) {
- const setTo = box.checked;
- const mails = document.getElementById('mail-headers').tBodies[0].rows;
+ const setTo = box.checked;
+ const mails = document.getElementById('mail-headers').tBodies[0].rows;
- for (const m of mails) {
- m.lastElementChild.children[0].checked = setTo;
- }
+ for (const m of mails) {
+ m.lastElementChild.children[0].checked = setTo;
+ }
}
-</script> \ No newline at end of file
+</script>
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;
<th class=sort-param>
- <a href="<%= url_with->query(sort => (param('sort') || '') eq $param ? '!' . $param : $param) %>">
+ %= 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;
- </a>
+ % end
</th>
% end
@@ -25,25 +25,28 @@
<thead>
<tr id=sort>
- <th> <%= ucfirst l 'nr' %> </th>
+ <th>
+ %= ucfirst l 'nr'
+ </th>
%= $sort_param->('status');
%= $sort_param->('date');
-
% if ($folder ne "SENT") {
%= $sort_param->('sender');
- % } else {
+ % }
+ % else {
<th class=sort-param>
- <a href="<%= url_with->query(sort => param('sort') ne '!sender' ? 'sender' : '!sender' ) %>">
- <%= ucfirst l 'recipient' %>
- % if (param('sort') eq "sender") {
- <IMG SRC="/down.gif" width="12" height="12" border="0" alt="v">
- % } elsif (param('sort') eq "recipient_rev") {
- <IMG SRC="/up.gif" width="12" height="12" border="0" alt="^">
- % }
- </a>
+ %= 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
</th>
% }
@@ -63,7 +66,7 @@
% foreach my $msgnum ($first_item .. $last_item) {
% my $msg = $msgs->[$msgnum - $first_item];
- <tr class="<%= $msg->{new} ? 'new-mail' : '' %>" id="<%= $msg->{mid} %>" >
+ %= tag tr => (class => $msg->{new} ? 'new-mail' : '') => (id => $msg->{mid}) => begin
<td>
%= $msgnum
</td>
@@ -78,15 +81,15 @@
%= $msg->{head}{from}[0]{name} || $msg->{head}{from}[0]{email};
</td>
<td>
- <a href="<%= url_for('read', id => $msg->{mid}) %>"> <%= $msg->{head}{subject} || '_' %> </a>
+ %= link_to $msg->{head}{subject} || '_' => read => {id => $msg->{mid}}
</td>
<td>
%= print_sizes10 $msg->{size};
</td>
<td>
- <input type=checkbox name=mail value="<%= $msg->{mid} %>" form=move-mail>
+ %= check_box mail => $msg->{mid} => (form => 'move-mail')
</td>
- </tr>
+ % end
% }
</tbody>
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 @@
%# <a href="<%= url_with($prefsurl) %>"><%= TXT 'userconfig' %></a>
%# <a href="<%=$prefsurl%>?action=editaddresses&folder=<%=$folder%>&sessionid=<%=$thissession%>&sort=<%=$sort%>&firstmessage=<%=$firstmessage+1%>&lang=<%=$lang%>" ><%= TXT 'addressbook' %></a>
<li>
- <a href="<%= url_for('logout') %>"><%= ucfirst l 'logout' %></a>
+ %= link_to ucfirst(l 'logout') => 'logout'
</li>
<li>
- <a href="<%= url_for('write') %>" ><%= ucfirst l 'compose' %></a>
+ %= link_to ucfirst(l 'compose') => 'write'
</li>
</ul>
</td>
<td>
- <form action="<%= url_for %>">
- <label for=search><%= ucfirst l 'search' %></label>: <input type=search name=search size=8>
- </form>
+ %= form_for '' => begin
+ %= label_for search => ucfirst(l 'search') . ': '
+ %= search_field search => (size => 8)
+ % end
</td>
<td id=pag2>
@@ -30,4 +31,4 @@
</td>
</tr>
-</table> \ No newline at end of file
+</table>
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 @@
<tr>
<td id=folder-list class=alter-font>
- <strong class=up> <%= l($folder) || $folder %> </strong>
+ <strong class=up>
+ %= l($folder) || $folder
+ </strong>
<ul class=line>
% for my $v (grep {$_ ne $folder} @$mail_folders) {
- <li><a href="<%= url_for(folder => $v) %>" class=bright> <%= $v ne '' ? (l($v) || $v) : l 'Home' %> </a></li>
+ <li>
+ %= link_to '' => {folder => $v} => (class => 'bright') => begin
+ %= $v ? (l($v) || $v) : l 'Home'
+ % end
+ </li>
% }
</ul>
</td>
<td>
<em class=msg-count>
- <%= $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 %>
% }
</em>
</td>
</tr>
-</table> \ No newline at end of file
+</table>