Permalink
Browse files

Finally put in default support to let random pages get created

  • Loading branch information...
1 parent 9df201e commit aeef425d0c3d303b5c9fc733acf6e328e83da36b @jshirley jshirley committed Jun 19, 2010
Showing with 15 additions and 0 deletions.
  1. +15 −0 lib/StyleGuide/Controller/Root.pm
@@ -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);
}

0 comments on commit aeef425

Please sign in to comment.