]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Base.pm
Add form.js markup and CSS
[gruntmaster-page.git] / lib / Gruntmaster / Page / Base.pm
index 47beca71695a2e56c03221d1f5d4c4fbe0143cf2..91c2764ffb6209e30a0d0a61c174cce81d212044 100644 (file)
@@ -52,7 +52,7 @@ my %orig_header_templates = (
 
 <div class="collapse navbar-collapse">
 <ul class="nav navbar-nav">
-<li><a href="/pb/">Problem list</a>
+<li><a href="/pb/">Problems</a>
 <li><a href="/ct/">Contests</a>
 <li><a href="/account">Account</a>
 </ul>
@@ -75,9 +75,8 @@ my %orig_header_templates = (
 
 <div class="container-fluid">
 
-<div id="title"><span class="i">i</span><span class="Eval">Eval</span></div>
 <div id="subtitle">TITLE_GOES_HERE</div>
-
+<div id="result"></div>
 HTML
 );
 
@@ -93,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.*>) {
@@ -104,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]};
 }
 
@@ -137,11 +133,11 @@ 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);
-       [200, ['Content-Type' => 'text/html', 'Content-Language' => $_[1]], [ encode 'UTF-8' => $htc->output ] ]
+       [200, ['Content-Type' => 'text/html', 'Content-Language' => $_[1], 'Vary' => 'Accept-Language'], [ encode 'UTF-8' => $htc->output ] ]
 }
 
 sub _generate {}
This page took 0.025641 seconds and 4 git commands to generate.