]> 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 f0952cf6228cc468aa77155a9a30a28581853591..f2ce142269abbc94f5b1f46951cde1b193c9da18 100644 (file)
@@ -138,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},
@@ -157,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');
@@ -192,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) = @_;
@@ -199,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.027896 seconds and 4 git commands to generate.