Mercurial > pub > Impl
diff Lib/IMPL/Web/View/TTFactory.pm @ 343:9bdccdf1f50b
Added a templates context
author | cin |
---|---|
date | Fri, 13 Sep 2013 12:53:15 +0400 |
parents | 97628101b765 |
children |
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/TTFactory.pm Wed Jul 03 03:53:12 2013 +0400 +++ b/Lib/IMPL/Web/View/TTFactory.pm Fri Sep 13 12:53:15 2013 +0400 @@ -115,7 +115,6 @@ $this->LoadLabelsToContext($context); } -#TODO optimize labels loading for extended classes sub LoadLabelsToContext { my ($this,$context) = @_; @@ -131,7 +130,7 @@ if (-f $flabels) { my %labels; - $labels{default} = IMPL::Resources::Strings::ParseStringsMap("$flabels"); + $labels{default} = IMPL::Resources::Strings::ParseStringsMap($flabels); while(my($label,$text) = each %{$labels{default}}) { $vars{$label} = sub { @@ -165,7 +164,7 @@ } $refProps->{factory} = $this; - my $ctx = $this->CloneContext(); + my $ctx = $this->context->clone(); return ($this->template, $ctx, $refProps); } @@ -178,19 +177,6 @@ $this->next::method(@_); } -sub CloneContext { - my ($this) = @_; - - $this->context->localise(); - - my $args = { %{$this->context} }; - delete $args->{CONFIG}; - - $this->context->delocalise(); - - return Template::Context->new($args); -} - sub Render { my ($this, $args) = @_; @@ -251,6 +237,9 @@ C< Inherits L<IMPL::Object::Factory> > +Соединяет в себе шаблон и заранее подготовленный контекст, который будет базой +для создаваемых элементов управления. + =head1 MEMBERS =over