]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Ct.pm
Heeere's Plack/PSGI!
[gruntmaster-page.git] / lib / Gruntmaster / Page / Ct.pm
index 1c108fddf5162f534ede875c41128c6e89c3d69d..4aa3254c4a58daccead353d15daf2659bc9e8297 100644 (file)
@@ -3,20 +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 HTML::Template::Compiled;
-use POSIX qw/strftime/;
-use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
-use Gruntmaster::Data qw/contests contest_name contest_start contest_end contest_owner/;
-
-my %orig_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>
@@ -30,7 +25,7 @@ my %orig_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>
@@ -44,7 +39,7 @@ my %orig_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>
@@ -56,13 +51,11 @@ my %orig_templates = (
 </table>
 </tmpl_if>
 HTML
-);
-
-my %templates = cook_templates %orig_templates, ct => 'Contests';
+};
 
-sub generate{
-       %templates = cook_templates %orig_templates, ct => 'Contests' if reload_templates;
-       my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
+sub _generate{
+       my ($self, $htc, $lang, $logger) = @_;
+       debug $logger => "language is '$lang'";
 
        my (@running, @pending, @finished);
        for (contests) {
@@ -78,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.023183 seconds and 4 git commands to generate.