]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Ct/Entry.pm
Add example test suite
[gruntmaster-page.git] / lib / Gruntmaster / Page / Ct / Entry.pm
index 3c336c17bd0939c7b36460194b1a831b76a3972d..acc076ead75666d4be6147ce3850669e535fd152 100644 (file)
@@ -3,43 +3,19 @@ package Gruntmaster::Page::Ct::Entry;
 use 5.014000;
 use strict;
 use warnings;
-use parent qw/Exporter/;
-our @EXPORT_OK = qw/generate/;
+use Gruntmaster::Page::Base ct_entry => '<tmpl_var name>';
+our @ISA = qw/Gruntmaster::Page::Base/;
 our $VERSION = '0.001';
 
-use constant TITLE => '<tmpl_var name>';
+sub _generate{
+       my ($self, $htc, $lang, $env, $id) = @_;
+       debug $env => "language is '$lang' and id is '$id'";
 
-use HTML::Template::Compiled;
-use POSIX qw/strftime/;
-use Gruntmaster::Page::Common qw/header footer/;
-use Gruntmaster::Data qw/contest_name contest_start contest_end/;
-
-my %templates = (
-       en => <<'HTML',
-Contest start time: <tmpl_var start><br>
-Contest end time: <tmpl_var end><p>
-
-<tmpl_if started><a href="pb/">Problems</a><br>
-<a href="log/">Job log</a><br>
-<a href="log/st.var">Standings</a></tmpl_if>
-HTML
-);
-
-$templates{$_}  = header($_, TITLE) . $templates{$_} for keys %templates;
-$templates{$_} .= footer $_ for keys %templates;
-
-sub generate{
-       my ($path, $lang) = @_;
-       $path = ($path =~ m,ct/(.*)/index,)[0];
-       my $template = $templates{$lang};
-       my $htc = HTML::Template::Compiled->new(scalarref => \$template);
-
-       $htc->param(id => $path);
-       $htc->param(name => contest_name $path);
-       $htc->param(start => strftime '%c', contest_start);
-       $htc->param(end => strftime '%c', contest_end);
-       $htc->param(started => time >= contest_start);
-       $htc->output
+       $htc->param(id => $id);
+       $htc->param(name => contest_name $id);
+       $htc->param(start => strftime '%c', localtime contest_start $id);
+       $htc->param(end => strftime '%c', localtime contest_end $id);
+       $htc->param(started => time >= contest_start $id);
 }
 
 1
This page took 0.016043 seconds and 4 git commands to generate.