From: Marius Gavrilescu Date: Wed, 4 Feb 2015 13:59:17 +0000 (+0200) Subject: Add editorial support X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=645cfb7d047f81aa613d6d68436a972f5db103ee;p=plack-app-gruntmaster.git Add editorial support --- diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index 007ad6b..0edfe5a 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -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; diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index d68874b..abb2779 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -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); +} diff --git a/tmpl/ct_entry.en b/tmpl/ct_entry.en index 6f0a580..5a44866 100644 --- a/tmpl/ct_entry.en +++ b/tmpl/ct_entry.en @@ -7,6 +7,7 @@ diff --git a/tmpl/ed.en b/tmpl/ed.en new file mode 100644 index 0000000..12d47a7 --- /dev/null +++ b/tmpl/ed.en @@ -0,0 +1,7 @@ +
+
+

250 - Name

+
+
+
+
\ No newline at end of file