Update docs to match new ::Controller::Root
[catagits/Reaction.git] / lib / Reaction / UI / View / TT.pm
CommitLineData
7adfd53f 1package Reaction::UI::View::TT;
2
3use Reaction::Class;
4use aliased 'Reaction::UI::View';
5use Template;
6
7class TT is View, which {
8
9 has '_tt' => (isa => 'Template', is => 'rw', lazy_fail => 1);
10
11 implements 'BUILD' => as {
12 my ($self, $args) = @_;
13 my $tt_args = $args->{tt}||{};
14 $self->_tt(Template->new($tt_args));
15 };
16
17 overrides 'layout_set_args_for' => sub {
18 my ($self) = @_;
19 return (super(), tt_object => $self->_tt);
20 };
21
22 overrides 'rendering_context_args_for' => sub {
23 my ($self, %args) = @_;
d193faa5 24 return ();
7adfd53f 25 };
26
27 implements 'serve_static_file' => as {
28 my ($self, $c, $args) = @_;
29 foreach my $path (@{$self->search_path_for_type('web')}) {
30 my $cand = $path->file(@$args);
31 if ($cand->stat) {
32 $c->serve_static_file($cand);
33 return 1;
34 }
35 }
36 return 0;
37 };
38
39};
40
411;