]> iEval git - plack-app-gruntmaster.git/blobdiff - lib/Gruntmaster/Page/Log/Entry.pm
Centralize template cooking and introduce reloadable templates
[plack-app-gruntmaster.git] / lib / Gruntmaster / Page / Log / Entry.pm
index 3e9e08fed2f2d8762a93a62f87ab6cdf07ccde26..8fed9a19fb6aa3b28730a900c07d088ef511eb19 100644 (file)
@@ -7,14 +7,12 @@ use parent qw/Exporter/;
 our @EXPORT_OK = qw/generate/;
 our $VERSION = '0.001';
 
-use constant TITLE => 'Job <tmpl_var id>';
-
 use HTML::Template::Compiled;
 use POSIX qw/strftime/;
-use Gruntmaster::Page::Common qw/header footer/;
+use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
 use Gruntmaster::Data qw/job_results/;
 
-my %templates = (
+my %orig_templates = (
        en => <<'HTML',
 <table border>
 <thead>
@@ -26,10 +24,10 @@ my %templates = (
 HTML
 );
 
-$templates{$_}  = header($_, TITLE) . $templates{$_} for keys %templates;
-$templates{$_} .= footer $_ for keys %templates;
+my %templates = cook_templates %orig_templates, log_entry => 'Job <tmpl_var id>';
 
 sub generate{
+       %templates = cook_templates %orig_templates, log_entry => 'Job <tmpl_var id>' if reload_templates;
        $_[0] =~ m,^(?:ct/([^/]+)/)?log/job/([^/]+)\.html$,;
        local $Gruntmaster::Data::contest = $1;
        my $id = $2;
This page took 0.024675 seconds and 4 git commands to generate.