Mercurial > pub > Impl
comparison Lib/IMPL/Web/View/TTContext.pm @ 355:8dfb9df07d02
added support for the custom resolvers for the TTView
author | sergey |
---|---|
date | Thu, 17 Oct 2013 01:04:37 +0400 |
parents | 9330835535b9 |
children | 97131d500f16 |
comparison
equal
deleted
inserted
replaced
354:9330835535b9 | 355:8dfb9df07d02 |
---|---|
32 prefix | 32 prefix |
33 cache | 33 cache |
34 includes | 34 includes |
35 modules | 35 modules |
36 aliases | 36 aliases |
37 resolver | |
38 )) { | 37 )) { |
39 my $t = $prop; | 38 my $t = $prop; |
40 | 39 |
41 *{__PACKAGE__ . '::' . $prop} = sub { | 40 *{__PACKAGE__ . '::' . $prop} = sub { |
42 my $this = shift; | 41 my $this = shift; |
147 model => $model, | 146 model => $model, |
148 prefix => "" | 147 prefix => "" |
149 }; | 148 }; |
150 } | 149 } |
151 | 150 |
151 $template ||= $info->{template}; | |
152 $template = $template ? $this->find_template($template) : $this->find_template_for($info->{model}); | 152 $template = $template ? $this->find_template($template) : $this->find_template_for($info->{model}); |
153 | 153 |
154 return $this->render( | 154 return $this->render( |
155 $template, | 155 $template, |
156 hashApply( | 156 hashApply( |
288 die ArgException->new(prefix => "the prefix must be specified") | 288 die ArgException->new(prefix => "the prefix must be specified") |
289 unless defined $prefix; | 289 unless defined $prefix; |
290 | 290 |
291 #TODO handle DOM models | 291 #TODO handle DOM models |
292 | 292 |
293 if (my $resolver = $this->resolver) { | 293 if (my $res = $this->stash->get(['resolver', [$this,$prefix,$args]] ) ) { |
294 return $this->$resolver($prefix,$args); | 294 return $res; |
295 } | 295 } |
296 | 296 |
297 my @comp = map { $_, 0 } grep length($_), split(/\.|\[(\d+)\]/, $prefix); | 297 my @comp = map { $_, 0 } grep length($_), split(/\.|\[(\d+)\]/, $prefix); |
298 | 298 |
299 return { | 299 return { |