X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;ds=inline;f=lib%2FGruntmaster%2FPage%2FBase.pm;h=b328d2b257fbfa84a36478a8fad500a46e8cef71;hb=db3d5b78fecd78a000cd92b2b29ca8cffea59b4d;hp=80fa027d5b2651249c504405476b182ab2ac57d2;hpb=6e80032b72a728493d8155520539ab074d51d12a;p=plack-app-gruntmaster.git
diff --git a/lib/Gruntmaster/Page/Base.pm b/lib/Gruntmaster/Page/Base.pm
index 80fa027..b328d2b 100644
--- a/lib/Gruntmaster/Page/Base.pm
+++ b/lib/Gruntmaster/Page/Base.pm
@@ -52,7 +52,7 @@ my %orig_header_templates = (
@@ -92,7 +92,8 @@ HTML
);
sub patch_templates {
- my $root = $ENV{GRUNTMASTER_TEMPLATE_ROOT} or return %{$_[0]};
+ my $root = 'tmpl';
+ return %{$_[0]} unless -d $root;
my ($templates, $name) = @_;
my %out = %$templates;
for (<$root/$name.*>) {
@@ -103,19 +104,15 @@ sub patch_templates {
%out
}
-sub reload_templates (){ $ENV{GRUNTMASTER_RELOAD_TEMPLATES} }
-
my %header_templates = patch_templates \%orig_header_templates, 'header';
my %footer_templates = patch_templates \%orig_footer_templates, 'footer';
sub header{
my ($language, $title) = @_;
- %header_templates = patch_templates \%orig_header_templates, 'header' if reload_templates;
$header_templates{$language} =~ s/TITLE_GOES_HERE/$title/ger;
}
sub footer{
- %footer_templates = patch_templates \%orig_footer_templates, 'footer' if reload_templates;
$footer_templates{$_[0]};
}
@@ -136,7 +133,7 @@ my %templates;
sub generate{
my ($self, $lang, @args) = @_;
- $templates{$self} = { cook_templates $self->TEMPLATES, $self->NAME => $self->TITLE } if !exists $templates{$self} or reload_templates;
+ $templates{$self} = { cook_templates $self->TEMPLATES, $self->NAME => $self->TITLE } unless exists $templates{$self};
my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$self}{$lang}, default_escape => 'HTML',);
$self->_generate($htc, $lang, @args);