Improve log_entry
authorMarius Gavrilescu <marius@ieval.ro>
Sun, 4 Jan 2015 15:19:35 +0000 (17:19 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sun, 4 Jan 2015 15:19:35 +0000 (17:19 +0200)
lib/Plack/App/Gruntmaster/HTML.pm
tmpl/log_entry.en

index f0952cf6228cc468aa77155a9a30a28581853591..5505a3917973f1f7991b4f691433018b68a521aa 100644 (file)
@@ -192,6 +192,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 +210,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 {
index eb05db8caae6796c1747dcc22e660d11a2c65acc..cb00e3346f3292d0b625b6f333b55fbdbef43a8b 100644 (file)
@@ -1,3 +1,9 @@
+<dl>
+<dt>Owner</dt>   <dd id="owner"><a href="/us/id">owner</a></dd>
+<dt>Problem</dt> <dd id="problem"><a href="/pb/id">problem</a></dd>
+<dt>Contest</dt> <dd id="contest"><a href="/ct/id">contest</a></dd>
+<dt>Source</dt>  <dd><a id="source" href="/log/id">1.55 KB</a></dd>
+
 <div id="errors">
 <h2>Compiler output</h2>
 <pre></pre>
This page took 0.012109 seconds and 4 git commands to generate.