]> iEval git - plack-app-gruntmaster.git/blobdiff - lib/Gruntmaster/Page/Ct.pm
Add Cache-Control to most requests
[plack-app-gruntmaster.git] / lib / Gruntmaster / Page / Ct.pm
index 19c4aad33cc319d4504768eb2b7fc8c30c4ac47a..ede25624f3dc5969c208fe3d01f8a5a8fa07a0f6 100644 (file)
@@ -3,22 +3,15 @@ package Gruntmaster::Page::Ct;
 use 5.014000;
 use strict;
 use warnings;
-use parent qw/Exporter/;
-our @EXPORT_OK = qw/generate/;
+use Gruntmaster::Page::Base ct => 'Contests';
+our @ISA = qw/Gruntmaster::Page::Base/;
 our $VERSION = '0.001';
 
-use constant TITLE => 'Contests';
-
-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 contest_owner/;
-
-my %templates = (
+use constant TEMPLATES => {
        en => <<'HTML',
 <tmpl_if running>
 <h1>Running contests</h1>
-<table border>
+<table border class="table table-bordered table-striped">
 <thead>
 <tr><th>Name<th>Start date<th>End date<th>Owner
 <tbody>
@@ -32,7 +25,7 @@ my %templates = (
 
 <tmpl_if pending>
 <h1>Pending contests</h1>
-<table border>
+<table border class="table table-bordered table-striped">
 <thead>
 <tr><th>Name<th>Start date<th>End date<th>Owner
 <tbody>
@@ -46,7 +39,7 @@ my %templates = (
 
 <tmpl_if finished>
 <h1>Finished contests</h1>
-<table border>
+<table border class="table table-bordered table-striped">
 <thead>
 <tr><th>Name<th>Start date<th>End date<th>Owner
 <tbody>
@@ -58,13 +51,11 @@ my %templates = (
 </table>
 </tmpl_if>
 HTML
-);
-
-$templates{$_}  = header($_, TITLE) . $templates{$_} for keys %templates;
-$templates{$_} .= footer $_ for keys %templates;
+};
 
-sub generate{
-       my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
+sub _generate{
+       my ($self, $htc, $lang, $env) = @_;
+       debug $env => "language is '$lang'";
 
        my (@running, @pending, @finished);
        for (contests) {
@@ -80,10 +71,9 @@ sub generate{
                push @finished, $ct if time > contest_end;
        }
 
-       $htc->param(running => \@running);
-       $htc->param(pending => \@pending);
-       $htc->param(finished => \@finished);
-       $htc->output
+       $htc->param(running => \@running) if @running;
+       $htc->param(pending => \@pending) if @pending;
+       $htc->param(finished => \@finished) if @finished;
 }
 
 1
This page took 0.032026 seconds and 4 git commands to generate.