comparison Lib/IMPL/Web/View/TTDocument.pm @ 191:78a18a2b6266

IMPL::Web::View improvements (unstable)
author cin
date Thu, 05 Apr 2012 17:51:51 +0400
parents cd1ff7029a63
children a9faf883cdce
comparison
equal deleted inserted replaced
190:cd1ff7029a63 191:78a18a2b6266
44 die new IMPL::Exception("A document is destroyed or invalid") unless $doc; 44 die new IMPL::Exception("A document is destroyed or invalid") unless $doc;
45 $doc->require(@_); 45 $doc->require(@_);
46 }); 46 });
47 47
48 $this->templateVars('document', sub { $self } ); 48 $this->templateVars('document', sub { $self } );
49 $this->InitInstance();
49 } 50 }
50 51
51 our %CTOR = ( 52 our %CTOR = (
52 'IMPL::Web::View::TTControl' => sub { 53 'IMPL::Web::View::TTControl' => sub {
53 'document', 54 'document',
78 } else { 79 } else {
79 80
80 my $path = $control; 81 my $path = $control;
81 if ( my $template = $this->loader->template($path) ) { 82 if ( my $template = $this->loader->template($path) ) {
82 83
83 my $opts = { %{$this->opts} }; 84 my $opts = { %{$this->loader->options} };
84 $opts->{STASH} = $this->stash->clone(); 85 $opts->{STASH} = $this->loader->context->stash->clone();
85 86
86 my $ctx = new Template::Context($opts); 87 my $ctx = new Template::Context($opts);
87 88
88 $factory = new IMPL::Web::View::TTFactory( 89 $factory = new IMPL::Web::View::TTFactory(
89 typeof IMPL::Web::View::TTControl, 90 typeof IMPL::Web::View::TTControl,
113 114
114 my $output; 115 my $output;
115 116
116 if ($this->layout) { 117 if ($this->layout) {
117 $output = $this->context->include( 118 $output = $this->context->include(
118 $this->layout, 119 $this->loader->template($this->layout),
119 { 120 {
120 content => sub { $output ||= $this->RenderContent($args); } 121 content => sub { $output ||= $this->RenderContent($args); }
121 } 122 }
122 ); 123 );
123 } else { 124 } else {