Mercurial > pub > Impl
diff Lib/IMPL/Web/View/TTDocument.pm @ 301:aeeb57a12046
*IMPL::Web::View: templates inheritance support
author | cin |
---|---|
date | Mon, 25 Mar 2013 02:04:18 +0400 |
parents | bf3af33b9003 |
children | a5eb64c6e6f7 |
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/TTDocument.pm Fri Mar 22 01:05:11 2013 +0400 +++ b/Lib/IMPL/Web/View/TTDocument.pm Mon Mar 25 02:04:18 2013 +0400 @@ -31,6 +31,7 @@ $this->loader($loader) if $loader; $this->layout( $template->layout ) unless $this->layout; + $this->title( $template->title ) unless $this->title; $this->context->stash->update($vars) if ref $vars eq 'HASH'; @@ -51,7 +52,7 @@ my $control = shift; unless($self) { - carp("Cant load control $control outside the rendering procedure"); + carp("Cant load control $control outside the document rendering process"); return; } @@ -61,10 +62,14 @@ my $path = $control; if ( my $template = $self->loader->template($path) ) { + + $documentContext->localise(); + my $ctx = _clone_context($documentContext); + $documentContext->delocalise(); $factory = new IMPL::Web::View::TTFactory( $template, - $documentContext, + $ctx, join( '/', splice( @{[split(/\//,$path)]}, 0, -1 ) ), $require ); @@ -114,6 +119,8 @@ return $this->next::method($args); } }; + + my $e = $@; undef $require; undef $documentContext; @@ -121,15 +128,11 @@ undef $self; $this->context->delocalise(); - - my $e = $@; if ($e) { die $e; } else { return $text; } - - } sub _clone_context {