1 package Reaction::UI::Controller::Root;
3 use base qw/Reaction::UI::Controller/;
5 use Reaction::UI::Window;
9 content_type => 'text/html',
12 has 'view_name' => (isa => 'Str', is => 'rw');
13 has 'content_type' => (isa => 'Str', is => 'rw');
14 has 'window_title' => (isa => 'Str', is => 'rw');
17 my ($self, $ctx) = @_;
19 window => Reaction::UI::Window->new(
21 view_name => $self->view_name,
22 content_type => $self->content_type,
23 title => $self->window_title,
26 $ctx->stash(focus_stack => $ctx->stash->{window}->focus_stack);
30 my ($self, $ctx) = @_;
31 $ctx->stash->{window}->flush;
38 Reaction::UI::Controller::Root - Base component for the Root Controller
42 package MyApp::Controller::Root;
43 use base 'Reaction::UI::Controller::Root';
47 window_title => 'Reaction Test App',
52 $c->stash->{focus_stack}->push_viewport('Reaction::UI::ViewPort');
54 # Access the window title in a template:
59 Using this module as a base component for your L<Catalyst> Root
60 Controller provides automatic creation of a L<Reaction::UI::Window>
61 object containing an empty L<Reaction::UI::FocusStack> for your UI
62 elements. The stack is also resolved and rendered for you in the
65 At the C<begin> of each request, a L<Reaction::UI::Window> object is
66 created using the configured L</view_name>, L</content_type> and
67 L</window_title>. These thus should be directly changed on the stashed
68 window object at runtime, if needed.
76 =item Arguments: $viewname?
80 Set or retrieve the classname of the view used to render the UI. Can
81 also be set by a call to config. Defaults to 'XHTML'.
87 =item Arguments: $contenttype?
91 Set or retrieve the content type of the page created. Can also be set
92 by a call to config or in a config file. Defaults to 'text/html'.
98 =item Arguments: $windowtitle?
102 Set or retrieve the title of the page created. Can also be set by a
103 call to config or in a config file. No default.
107 See L<Reaction::Class> for authors.
111 See L<Reaction::Class> for the license.