]> iEval git - plack-app-gruntmaster.git/blobdiff - lib/Plack/App/Gruntmaster/HTML.pm
Pass private argument to job log from pb_entry
[plack-app-gruntmaster.git] / lib / Plack / App / Gruntmaster / HTML.pm
index 6921981215ac79bb7633f082436282a27065c785..f2ce142269abbc94f5b1f46951cde1b193c9da18 100644 (file)
@@ -79,6 +79,7 @@ sub process_skel {
 sub process_us_entry {
        my ($tree, %args) = @_;
        $tree->fid($_)->attr('href', "/$_/?owner=$args{id}") for qw/log pb/;
+       $tree->fid('track_user')->attr('data-user', $args{id});
        my @solved = map { $_->{solved} ? ($_->{problem}) : () } @{$args{problems}};
        my @attempted = map { !$_->{solved} ? ($_->{problem}) : () } @{$args{problems}};
 
@@ -137,6 +138,7 @@ sub process_pb_entry {
        $tree->fid('owner')->edit_href(sub{s/owner_id/$args{owner}/});
        $tree->fid('job_log')->edit_href(sub{s/problem_id/$args{id}/});
        $tree->fid('solution')->edit_href(sub{s/problem_id/$args{id}/});
+       $tree->fid('job_log')->edit_href(sub{$_ .= "&private=$args{private}"}) if $args{private};
        $tree->content_handler(
                statement => literal $args{statement},
                author    =>         $args{author},
@@ -156,6 +158,7 @@ sub process_pb_entry {
                $_->detach for $tree->fclass('rc'); # requires contest
                $tree->fid('solution_modal')->fclass('modal-body')->replace_content(literal $args{solution});
        }
+       $tree->fid('solution')->detach unless $args{solution};
        if ($args{cansubmit}) {
                $tree->look_down(name => 'problem')->attr(value => $args{id});
                my $contest = $tree->look_down(name => 'contest');
@@ -191,6 +194,17 @@ sub process_pb {
 
 sub process_log_entry {
        my ($tree, %args) = @_;
+       $tree->fid('problem')->namedlink(@args{qw/problem problem_name/});
+       $tree->fid('owner')->namedlink(@args{qw/owner owner_name/});
+       $tree->fid('source')->namedlink("$args{id}.$args{extension}", sprintf '%.2fKB', $args{size}/1024);
+       if ($args{contest}) {
+               $tree->fid('contest')->namedlink(@args{qw/contest contest_name/});
+               $tree->fid('problem')->find('a')->edit_href(sub {$_.="?contest=$args{contest}"});
+       } else {
+               $tree->fid('contest')->left->detach;
+               $tree->fid('contest')->detach;
+       }
+
        $args{errors} ? $tree->fid('errors')->find('pre')->replace_content($args{errors}) : $tree->fid('errors')->detach;
        my $iter = sub {
                my ($data, $tr) = @_;
@@ -198,7 +212,7 @@ sub process_log_entry {
                $tr->defmap(class => $data);
                $tr->fclass('result_text')->attr(class => "r$data->{result}")
        };
-       @{$args{results}} ? $tree->fid('results')->find('tbody')->find('tr')->iter3($args{results}, $iter) : $tree->fid('results')->detach;
+       $args{results} ? $tree->fid('results')->find('tbody')->find('tr')->iter3($args{results}, $iter) : $tree->fid('results')->detach;
 }
 
 sub process_log {
This page took 0.023551 seconds and 4 git commands to generate.