Skip to content

Commit

Permalink
Finally put in default support to let random pages get created
Browse files Browse the repository at this point in the history
  • Loading branch information
jshirley committed Jun 19, 2010
1 parent 9df201e commit aeef425
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/StyleGuide/Controller/Root.pm
Expand Up @@ -72,6 +72,21 @@ Standard 404 error page

sub default : Private {
my ( $self, $c ) = @_;

my $design = $c->req->cookie('design');
if ( not $design ) {
$design = $c->view('StyleGuide')->default_style
} else {
$design = $c->view('StyleGuide')->get_design($design->value);
}
if ( $design ) {
my $path = $c->req->uri->path;
$path =~ s/^\///;
if ( -f "$design->{root}/$path.tt" ) {
$c->stash->{template} = "$path.tt";
return;
}
}
$c->response->body( 'Page not found' );
$c->response->status(404);
}
Expand Down

0 comments on commit aeef425

Please sign in to comment.