Mercurial > pub > Impl
comparison Lib/IMPL/Web/View/TTDocument.pm @ 267:bbc0da7ef90e
*IMPL::Web::View refactoring
author | cin |
---|---|
date | Thu, 17 Jan 2013 02:39:44 +0400 |
parents | 0f59b2de72af |
children | 546957c50a36 |
comparison
equal
deleted
inserted
replaced
266:89179bb8c388 | 267:bbc0da7ef90e |
---|---|
73 return $this->stash->get($name); | 73 return $this->stash->get($name); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 sub RequireControl { | 77 sub RequireControl { |
78 my ($this, $control, $nodeProps) = @_; | 78 my ($this, $control) = @_; |
79 | |
80 $nodeProps ||= {}; | |
81 $nodeProps->{document} = $this; | |
82 | 79 |
83 if (my $factory = $this->controls->{$control}) { | 80 if (my $factory = $this->controls->{$control}) { |
84 return $factory; | 81 return $factory; |
85 } else { | 82 } else { |
86 | 83 |
87 my $path = $control; | 84 my $path = $control; |
85 | |
88 if ( my $template = $this->loader->template($path) ) { | 86 if ( my $template = $this->loader->template($path) ) { |
89 my $opts = { %{$this->opts} }; | 87 my $opts = { %{$this->opts} }; |
90 | 88 |
91 # factory will create a clone of the stash | 89 # factory will create a clone of the stash |
92 # $opts->{STASH} = $this->stash->clone(); | 90 # $opts->{STASH} = $this->stash->clone(); |
95 | 93 |
96 $factory = new IMPL::Web::View::TTFactory( | 94 $factory = new IMPL::Web::View::TTFactory( |
97 $template->class || TTControl, | 95 $template->class || TTControl, |
98 $template, | 96 $template, |
99 $ctx, | 97 $ctx, |
100 $opts | 98 $opts, |
99 join( '/', splice( @{[split(/\//,$path)]}, 0, -1 ) ) | |
101 ); | 100 ); |
102 | 101 |
103 if ($template->class) { | 102 if ($template->class) { |
104 Loader->safe->Require($template->class); | 103 Loader->safe->Require($template->class); |
105 } | 104 } |