]> iEval git - gruntmaster-page.git/commitdiff
Add editorial support
authorMarius Gavrilescu <marius@ieval.ro>
Wed, 4 Feb 2015 13:59:17 +0000 (15:59 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Wed, 4 Feb 2015 13:59:17 +0000 (15:59 +0200)
lib/Plack/App/Gruntmaster.pm
lib/Plack/App/Gruntmaster/HTML.pm
tmpl/ct_entry.en
tmpl/ed.en [new file with mode: 0644]

index 007ad6bd754369773e356cab360cfdde552c0e4c..0edfe5abd99615f54778a703cef7b8ee354663ce 100644 (file)
@@ -152,6 +152,11 @@ sub dispatch_request{
                        }, 10
                },
 
+               sub (/ed/:contest) {
+                       forbid contest->is_running;
+                       response ed => 'Editorial of ' . contest->name, db->problem_list(contest => $_{contest}, solution => 1);
+               },
+
                sub (/login) {
                        forbid !remote_user;
 
index d68874b425274763859e783a847a462e90a48103..abb2779ce49f8576527343237f055676b42bcaee 100644 (file)
@@ -266,3 +266,15 @@ sub process_st {
        };
        $tree->find('tbody')->find('tr')->iter3($args{st}, $iter);
 }
+
+sub process_ed {
+       my ($tree, %args) = @_;
+       my $iter = sub {
+               my ($data, $div) = @_;
+               $div->set_child_content(class => 'value', $data->{value});
+               $div->set_child_content(class => 'solution', literal $data->{solution});
+               $div->fclass('problem')->namedlink($data->{id}, $data->{name});
+       };
+       my @pb = map { @{$args{$_}} } qw/beginner easy medium hard/;
+       $tree->fclass('well')->iter3(\@pb, $iter);
+}
index 6f0a5806cf9d86c80c73e5bc16859b35d22d0e11..5a44866c2488e0f3eed2b9ee6d8a5786646e7034 100644 (file)
@@ -7,6 +7,7 @@
 
 <div id="links">
 <a href="/pb/?contest=contest_id">Problems</a><br>
+<a href="/ed/contest_id">Editorial</a><br>
 <a href="/log/?contest=contest_id">Job log</a><br>
 <a href="/st/contest_id">Standings</a>
 </div>
diff --git a/tmpl/ed.en b/tmpl/ed.en
new file mode 100644 (file)
index 0000000..12d47a7
--- /dev/null
@@ -0,0 +1,7 @@
+<div>
+<div class="well">
+<h2><span class="value">250</span> - <a class="problem" href="/pb/id">Name</a></h2>
+<div class="solution">
+</div>
+</div>
+</div>
\ No newline at end of file
This page took 0.031597 seconds and 4 git commands to generate.