]> iEval git - plack-app-gruntmaster.git/commitdiff
Greatly improve user list
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Dec 2014 13:18:11 +0000 (15:18 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Dec 2014 13:18:11 +0000 (15:18 +0200)
lib/Plack/App/Gruntmaster/HTML.pm
tmpl/us.en

index 2ae8a4410626037942da16ff01399768760f934e..26669c7da1c520d5b88d6b7b4b7aec55d9917f05 100644 (file)
@@ -102,13 +102,12 @@ sub process_us_entry {
 
 sub process_us {
        my ($tree, %args) = @_;
-       my $item = $tree->fclass('list-group-item');
-       $item->replace_with(map {
-               my $new = $item->clone;
-               $new->attr(href => $_->{id});
-               $new->replace_content($_->{name} || $_->{id});
-               $new
-       } @{$args{us}});
+       my $iter = sub {
+               my ($data, $tr) = @_;
+               $tr->fclass('user')->namedlink($data->{id}, $data->{name});
+               $tr->fclass($_)->replace_content($data->{$_}) for qw/solved attempted contests/;
+       };
+       $tree->find('tbody')->find('tr')->iter3($args{us}, $iter);
 }
 
 sub process_ct_entry {
index dad8844cd271d0588cdb392efc6ee6e0f55f0fde..2d9f54196122e9b641c776af2acc62ab9dcde8ed 100644 (file)
@@ -1,3 +1,4 @@
-<div class="list-group">
-<a class="list-group-item" href="/us/id">Name</a>
-<div>
+<table border class="table table-bordered table-striped">
+<thead><tr><th>User<th>Solved problems<th>Attempted problems<th>Attended contests</thead>
+<tbody><tr><td class="user"><a href="/us/id">Name</a><td class="solved">10<td class="attempted">5<td class="contests">1
+</table>
This page took 0.036879 seconds and 4 git commands to generate.