Changeset 245

Show
Ignore:
Timestamp:
06/16/07 00:12:09 (3 years ago)
Author:
eevee
Message:

Fixed 404s and gave them sorta a real page, I guess.

Location:
veekun/trunk
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • veekun/trunk/lib/Vee/Controller/Root.pm

    r135 r245  
    6464sub default : Private { 
    6565    my ($self, $c) = @_; 
    66      
    67     $c->stash->{template} = join('/', @{ $c->req->args }) . '.tt'; 
     66 
     67    my @path_parts = @{ $c->req->args }; 
     68 
     69    if (not -e $c->path_to('static', @path_parts) . '.tt') { 
     70        $c->stash->{template} = '404.tt'; 
     71        return; 
     72    } 
     73     
    6874    $c->stash->{additional_template_paths} = [ $c->path_to('static') ]; 
    69  
    70     if ($c->req->args->[0] eq 'dex') { 
     75    $c->stash->{template} = join('/', @path_parts) . '.tt'; 
     76 
     77    if ($path_parts[0] eq 'dex') { 
    7178        $c->stash( %Vee::Dex::all ); 
    7279    } 
  • veekun/trunk/templates/fatal.tt

    r1 r245  
    11[% META title = 'Flagrant Error' %] 
    22 
    3 <p>Whoops!</p> 
     3<h1>Whoops!</h1> 
    44 
    55<p>Something terrible, horrible, no-good, and very bad happened.  Probably my fault, not yours.</p>