X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FCt.pm;h=ac035854dd637a48824a8787e49c7924c117d0d7;hb=0b282e58119cc0dbce678ef56eab20cc352557b5;hp=8ef38155306fe9b42ec55e92089b04a6a5282086;hpb=2b0036ac8e077cc20cf9db6ff8dad4091ab50cb3;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Ct.pm b/lib/Gruntmaster/Page/Ct.pm index 8ef3815..ac03585 100644 --- a/lib/Gruntmaster/Page/Ct.pm +++ b/lib/Gruntmaster/Page/Ct.pm @@ -3,16 +3,11 @@ 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/contest_name contest_start contest_end contest_owner/; - -my %orig_templates = ( +use constant TEMPLATES => { en => <<'HTML',

Running contests

@@ -56,13 +51,10 @@ my %orig_templates = (
HTML -); - -my %templates = cook_templates %orig_templates, ct => 'Contests'; +}; -sub generate{ - %templates = cook_templates %orig_templates, ct => 'Contests' if reload_template; - my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]}); +sub _generate{ + my ($self, $htc, $path, $lang) = @_; my (@running, @pending, @finished); for (contests) { @@ -78,10 +70,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