[Jifty-commit] r1242 - in jifty/trunk: lib/Jifty lib/Jifty/Mason share/web/templates/_elements

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Jun 10 16:44:48 EDT 2006


Author: jesse
Date: Sat Jun 10 16:44:47 2006
New Revision: 1242

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Handler.pm
   jifty/trunk/lib/Jifty/Mason/Halo.pm
   jifty/trunk/share/web/templates/_elements/wrapper

Log:
 r12461 at pinglin:  jesse | 2006-06-10 16:43:09 -0400
 * Halos now work across fragment calls


Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm	(original)
+++ jifty/trunk/lib/Jifty/Handler.pm	Sat Jun 10 16:44:47 2006
@@ -177,6 +177,7 @@
     $self->apache( HTML::Mason::FakeApache->new( cgi => $self->cgi ) );
 
     # Build a new stash for the life of this request
+    warn "SEtting up a stash on $self";
     $self->stash({});
     local $HTML::Mason::Commands::JiftyWeb = Jifty::Web->new();
     Jifty->web->request( Jifty::Request->new()->fill( $self->cgi ) );

Modified: jifty/trunk/lib/Jifty/Mason/Halo.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Mason/Halo.pm	(original)
+++ jifty/trunk/lib/Jifty/Mason/Halo.pm	Sat Jun 10 16:44:47 2006
@@ -30,14 +30,16 @@
 
     return if $context->comp->path eq "/__jifty/halo";
 
-    my $DEPTH = $context->request->notes('_halo_depth') || 0;
-    my $STACK = $context->request->notes('_halo_stack')
-        || $context->request->notes( '_halo_stack' => [] );
-    my $INDEX_STACK = $context->request->notes('_halo_index_stack')
-        || $context->request->notes( '_halo_index_stack' => [] );
+    Jifty->handler->stash->{ '_halo_index_stack' } ||= [];
+
+    my $DEPTH = Jifty->handler->stash->{'_halo_depth'} || 0;
+    my $STACK = Jifty->handler->stash->{'_halo_stack'} ||= [];
+        
+    my $INDEX_STACK = Jifty->handler->stash->{'_halo_index_stack'};
+
     my $halo_base = Jifty->web->serial;
 
-    $context->request->notes('_halo_depth' => ++$DEPTH);
+    Jifty->handler->stash->{'_halo_depth'} = ++$DEPTH;
     if ($STACK->[-1]) {
         push @{$STACK->[-1]->{sql_statements}}, Jifty->handle->sql_statement_log;
         Jifty->handle->clear_sql_statement_log;
@@ -74,9 +76,9 @@
 
     return if $context->comp->path =~ "^/__jifty/halo";
 
-    my $STACK = $context->request->notes('_halo_stack');
-    my $INDEX_STACK = $context->request->notes('_halo_index_stack');
-    my $DEPTH = $context->request->notes('_halo_depth');
+    my $STACK = Jifty->handler->stash->{'_halo_stack'};
+    my $INDEX_STACK = Jifty->handler->stash->{'_halo_index_stack'};
+    my $DEPTH = Jifty->handler->stash->{'_halo_depth'};
 
     my $FRAME_ID = pop @$INDEX_STACK;
 
@@ -87,7 +89,7 @@
     Jifty->handle->clear_sql_statement_log;
 
 
-    $context->request->notes('_halo_depth' => $DEPTH-1 );
+    Jifty->handler->stash->{'_halo_depth'} = $DEPTH-1 ;
 
     # If 
     return if $self->_unrendered_component($context);
@@ -111,7 +113,7 @@
     my $self    = shift;
     my $context = shift;
     if (   $context->comp->is_subcomp()
-        or not $context->request->notes('in_body'))
+        or not Jifty->handler->stash->{'in_body'})
     {
         return 1;
     } else {
@@ -131,7 +133,7 @@
 
 sub render_component_tree {
     my $self  = shift;
-    my @stack = @{ Jifty->web->mason->notes('_halo_stack') };
+    my @stack = @{ Jifty->handler->stash->{'_halo_stack'} };
 
     for (@stack) {
         $_->{'render_time'} = int((Time::HiRes::time - $_->{'start_time'}) * 1000)/1000

Modified: jifty/trunk/share/web/templates/_elements/wrapper
==============================================================================
--- jifty/trunk/share/web/templates/_elements/wrapper	(original)
+++ jifty/trunk/share/web/templates/_elements/wrapper	Sat Jun 10 16:44:47 2006
@@ -18,7 +18,7 @@
 % Jifty::Mason::Halo->render_component_tree() if (Jifty->config->framework('DevelMode') );
 </body>
 </html>
-%$m->notes('in_body' => 0);
+% Jifty->handler->stash->{'in_body'} = 0;
 <%args>
 $title => ""
 </%args>
@@ -27,5 +27,5 @@
 $m->comp( 'header', title => $title);
 # now that we've printed out the header, we're inside the body, so it's safe to print
 # halo markers.
-$m->notes('in_body' => 1);
+Jifty->handler->stash->{'in_body'} = 1;
 </%init>


More information about the Jifty-commit mailing list