add a default 404 and 403 action, use the 404 on collection controller, make html...
[catagits/Reaction.git] / lib / Reaction / UI / Controller / Root.pm
index a5a8279..51b0655 100644 (file)
@@ -15,18 +15,32 @@ has 'window_title' => (isa => 'Str', is => 'rw');
 
 sub begin :Private {
   my ($self, $ctx) = @_;
-  my $window :Stashed = Reaction::UI::Window->new(
-                          ctx => $ctx,
-                          view_name => $self->view_name,
-                          content_type => $self->content_type,
-                          title => $self->window_title,
-                        );
-  my $focus_stack :Stashed = $window->focus_stack;
+  $ctx->stash(
+    window => Reaction::UI::Window->new(
+                ctx => $ctx,
+                view_name => $self->view_name,
+                content_type => $self->content_type,
+                title => $self->window_title,
+              )
+  );
+  $ctx->stash(focus_stack => $ctx->stash->{window}->focus_stack);
 }
 
 sub end :Private {
-  my $window :Stashed;
-  $window->flush;
+  my ($self, $ctx) = @_;
+  $ctx->stash->{window}->flush;
+}
+
+sub error_404 :Private {
+  my ($self, $c) = @_;
+  $c->res->body("Error 404: File not Found");
+  $c->res->status(404);
+}
+
+sub error_403 :Private {
+  my ($self, $c) = @_;
+  $c->res->body("Error 403: Forbidden");
+  $c->res->status(403);
 }
 
 1;