]> iEval git - gruntmaster-page.git/blame - lib/Gruntmaster/Page/Pb.pm
Add form.js markup and CSS
[gruntmaster-page.git] / lib / Gruntmaster / Page / Pb.pm
CommitLineData
42546e6c
MG
1package Gruntmaster::Page::Pb;
2
3use 5.014000;
4use strict;
5use warnings;
bb95f538
MG
6use Gruntmaster::Page::Base pb => 'Problems';
7our @ISA = qw/Gruntmaster::Page::Base/;
42546e6c
MG
8our $VERSION = '0.001';
9
bb95f538
MG
10use constant TEMPLATES => {
11 en => <<'HTML',
96f80a63 12<tmpl_if levels>
9be91908 13<h2>Beginner</h2>
a94f8453
MG
14<div class="list-group">
15<tmpl_loop beginner><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
16</tmpl_loop></div>
9be91908
MG
17
18<h2>Easy</h2>
a94f8453
MG
19<div class="list-group">
20<tmpl_loop easy><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
21</tmpl_loop></div>
9be91908
MG
22
23<h2>Medium</h2>
a94f8453
MG
24<div class="list-group">
25<tmpl_loop medium><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
26</tmpl_loop></div>
9be91908 27
9be91908 28<h2>Hard</h2>
a94f8453
MG
29<div class="list-group">
30<tmpl_loop hard><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
31</tmpl_loop></div>
96f80a63
MG
32
33<tmpl_else>
a94f8453
MG
34<div class="list-group">
35<tmpl_loop problems><a class="list-group-item" href="<tmpl_var id>"><tmpl_var name></a>
36</tmpl_loop></div>
96f80a63 37</tmpl_if>
42546e6c 38HTML
bb95f538 39};
42546e6c 40
bb95f538 41sub _generate{
7dc32473
MG
42 my ($self, $htc, $lang, $logger, $ct) = @_;
43 debug $logger => "language is '$lang' and contest is '$ct'";
44 local $Gruntmaster::Data::contest = $ct if $ct;
cd9af27e 45
cd9af27e
MG
46 my @problems = sort { $b->{name} cmp $a->{name} } map +{
47 id => $_,
48 name => problem_name,
49 level => problem_level}, problems;
bb95f538 50
cd9af27e
MG
51 for my $d (qw/beginner easy medium advanced hard/) {
52 $htc->param($d => [grep {$_->{level} and $_->{level} eq $d} @problems]);
53 }
54 $htc->param(levels => grep { $_->{level} } @problems);
55 $htc->param(problems => \@problems);
42546e6c
MG
56}
57
581
This page took 0.028235 seconds and 4 git commands to generate.