Adapt stats task to theme system

This commit is contained in:
Luc Didry
2016-07-19 14:26:07 +02:00
parent 48cc398efb
commit cc3281fe2f
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -15,12 +15,18 @@ sub run {
my $config = $c->app->plugin('Config', {
file => File::Spec->catfile($Bin, '..' ,'lutim.conf'),
theme => 'default',
default => {
stats_day_num => 365
}
});
my $text = slurp('templates/data.html.ep.template');
my $template = 'themes/'.$config->{theme}.'/templates/data.html.ep.template';
unless (-e $template) {
$config->{theme} = 'default';
$template = 'themes/'.$config->{theme}.'/templates/data.html.ep.template';
}
my $text = slurp($template);
my $dom = Mojo::DOM->new($text);
my $thead_tr = $dom->at('table thead tr');
my $tbody_tr = $dom->at('table tbody tr');
@@ -51,7 +57,7 @@ sub run {
}
}
}
spurt $dom, 'templates/data.html.ep';
spurt $dom, 'themes/'.$config->{theme}.'/templates/data.html.ep';
}
=encoding utf8
+1 -1
View File
@@ -86,7 +86,7 @@ EOF
print $f $makefile;
close $f;
open $f, '>', File::Spec->catfile($home, '.gitignore') or die "Unable to open $home/.gitignore: $!";
print $f 'public/packed/';
print $f "public/packed/\ntemplates/data.html.ep";
close $f;
} else {
say "$name theme already exists. Aborting.";