diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-03-08 18:06:46 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-03-08 18:06:46 +0100 |
commit | bab3dafafe324389c932554de3051e7f38f087c5 (patch) | |
tree | 38424b6aa502091adb29f38776c181135a50e76f | |
parent | a3653fc91cda3ff430a16bf04351e71844b92e95 (diff) |
toplist: background bargraphs for percentages
-rw-r--r-- | templates/toplist.html.ep | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/templates/toplist.html.ep b/templates/toplist.html.ep index 2784386..daead42 100644 --- a/templates/toplist.html.ep +++ b/templates/toplist.html.ep @@ -3,8 +3,13 @@ <div class="toplist"> <table> <tr><th>Meldung</th><th>Anteil</th><th>Anzahl</th></tr> +% my $max = stash('toplist')->[0][2]; % for my $entry (@{ stash('toplist') // [] }) { -<tr><td><%= $entry->[0] %></td><td><%= $entry->[1] %></td><td><%= $entry->[2] %></td></tr> +% my ($desc, $percent, $raw) = @{$entry}; +<tr> +<td style="position: relative;"><div style="z-index: -1; position: absolute; width:<%= int($raw * 100 / $max) %>%; background-color: #e2e2e2;"> </div><%= $desc %></td> +<td><%= $percent %></td> +<td><%= $raw %></td></tr> % } </table> </div> |