]> iEval git - plack-app-gruntmaster.git/blobdiff - lib/Gruntmaster/Page/Pb.pm
Close form element in Pb::Entry
[plack-app-gruntmaster.git] / lib / Gruntmaster / Page / Pb.pm
index 617112a539c99a73a3361e8a4e429914f7078754..0aae2b09d216b7d7470cb048eca41c570c6906f0 100644 (file)
@@ -18,9 +18,32 @@ use Gruntmaster::Page::Common qw/header footer/;
 
 my %templates = (
   en => <<'HTML',
+<tmpl_if levels>
+<h2>Beginner</h2>
+<ul>
+<tmpl_loop beginner><li><a href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></ul>
+
+<h2>Easy</h2>
+<ul>
+<tmpl_loop easy><li><a href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></ul>
+
+<h2>Medium</h2>
+<ul>
+<tmpl_loop medium><li><a href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></ul>
+
+<h2>Hard</h2>
+<ul>
+<tmpl_loop hard><li><a href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></ul>
+
+<tmpl_else>
 <ul>
 <tmpl_loop problems><li><a href="<tmpl_var id>"><tmpl_var name></a>
 </tmpl_loop></ul>
+</tmpl_if>
 HTML
 );
 
@@ -37,7 +60,11 @@ sub generate{
   my @problems = sort { $b->{name} cmp $a->{name} } map {
        my $meta = LoadFile $_;
        my $id = (m,^$path/(.*)/meta.yml$,)[0];
-       +{ id => $id, name => $meta->{name} } } <$path/*/meta.yml>;
+       +{ id => $id, name => $meta->{name}, level => $meta->{level} } } <$path/*/meta.yml>;
+  for my $d(qw/beginner easy medium advanced hard/) {
+       $htc->param($d => [grep {$_->{level} and $_->{level} eq $d} @problems]);
+  }
+  $htc->param(levels => grep { $_->{level} } @problems);
   $htc->param(problems => \@problems);
   $htc->output
 }
This page took 0.017168 seconds and 4 git commands to generate.