]> iEval git - gruntmaster-page.git/blobdiff - lib/Plack/App/Gruntmaster/HTML.pm
Greatly improve user list
[gruntmaster-page.git] / lib / Plack / App / Gruntmaster / HTML.pm
index b1f8dce71eac1678c38d0058e1a41873de53987c..26669c7da1c520d5b88d6b7b4b7aec55d9917f05 100644 (file)
@@ -93,7 +93,7 @@ sub process_us_entry {
 
        my $ctiter = sub {
                my ($data, $td) = @_;
-               $td->fclass('contest')->namedlink($data->{contest});
+               $td->fclass('contest')->namedlink($data->{contest}, $data->{contest_name});
                $td->fclass('score')->replace_content($data->{score});
                $td->fclass('rank')->replace_content($data->{rank});
        };
@@ -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 {
This page took 0.02073 seconds and 4 git commands to generate.