diff Lib/IMPL/Web/View/TTContext.pm @ 347:3eafa6fefa9f

sync
author cin
date Mon, 30 Sep 2013 17:36:17 +0400
parents f05634287ac7
children f116cd9fe7d9
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/TTContext.pm	Mon Sep 30 01:37:50 2013 +0400
+++ b/Lib/IMPL/Web/View/TTContext.pm	Mon Sep 30 17:36:17 2013 +0400
@@ -12,8 +12,27 @@
 	}
 };
 
+BEGIN {
+	no strict 'ref';
+	foreach my $prop (qw(
+	   base
+	   tt_ext
+	   shared
+	   parent
+	   prefix
+	)) {
+		my $t = $prop;
+		
+		*{__PACKAGE__ . '::' . $name} = sub {
+			my $this = shift;
+			return @_ ? $this->stash->set($t, @_) : $this->stash->get($t);
+		}
+	}
+}
+
 sub clone {
 	my $this = shift;
+	my $params = shift;
 	
 	$this->localise();	
 
@@ -25,19 +44,11 @@
 	
     delete $args->{CONFIG};
     
-    return $class->new($args);
-}
-
-sub base {
-	my $this = shift;
-	
-	return @_ ? $this->stash->set('base', @_) : $this->stash->get('base'); 
-}
-
-sub tt_ext {
-	my $this = shift;
-	
-	return @_ ? $this->stash->set('tt_ext', @_) : $this->stash->get('tt_ext');
+    my $clone = $class->new($args);
+    
+    $clone->stash->update($params) if $params;
+    
+    return $clone;
 }
 
 sub find_template {
@@ -69,6 +80,30 @@
 	return $this->stash->get([ 'require', [$name] ]);
 }
 
+sub display {
+	my $this = shift;
+	my $model = shift;
+	my $template, $args;
+	
+	if (ref $_[0] eq 'HASH') {
+		$args = shift;
+	} else {
+		$template = shift;
+		$args = shift;
+	}
+	
+	my $prefix = $this->prefix
+	
+	my $cloned = $this->clone({
+		prefix => $prefix,
+		shared => $this->shared || $this,
+		parent => $this 
+	});
+	
+	
+	
+}
+
 1;
 
 __END__