[Jifty-commit] r5460 - in jifty/trunk/lib/Jifty: Plugin

Jifty commits jifty-commit at lists.jifty.org
Sun May 11 22:52:22 EDT 2008


Author: ruz
Date: Sun May 11 22:52:22 2008
New Revision: 5460

Modified:
   jifty/trunk/lib/Jifty/Plugin/Halo.pm
   jifty/trunk/lib/Jifty/View/Declare/Page.pm

Log:
* maintain Jifty->handler->stash->{'in_body'} in declarative templates

Modified: jifty/trunk/lib/Jifty/Plugin/Halo.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Halo.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Halo.pm	Sun May 11 22:52:22 2008
@@ -72,12 +72,15 @@
             Jifty->web->escape($deparsed);
         },
     };
+    my $proscribed = $self->is_proscribed($frame);
 
-    Template::Declare->buffer->append($self->halo_header($frame));
+    Template::Declare->buffer->append($self->halo_header($frame))
+        unless $proscribed;
     $orig->();
 
     $frame = $self->pop_frame;
-    Template::Declare->buffer->append($self->halo_footer($frame));
+    Template::Declare->buffer->append($self->halo_footer($frame))
+        unless $proscribed;
 }
 
 =head2 halo_header frame -> string

Modified: jifty/trunk/lib/Jifty/View/Declare/Page.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/Page.pm	(original)
+++ jifty/trunk/lib/Jifty/View/Declare/Page.pm	Sun May 11 22:52:22 2008
@@ -70,7 +70,11 @@
 sub render_body {
     my ($self, $body_code) = @_;
 
-    body { $body_code->() };
+    body {
+        Jifty->handler->stash->{'in_body'} = 1;
+        $body_code->();
+        Jifty->handler->stash->{'in_body'} = 0;
+    };
 }
 
 =head2 render_page
@@ -208,7 +212,10 @@
     my $title = shift || '';
     $title =~ s/<.*?>//g;    # remove html
     HTML::Entities::decode_entities($title);
+    my $old = Jifty->handler->stash->{'in_body'};
+    Jifty->handler->stash->{'in_body'} = 0;
     with( title => $title ), show('/header');
+    Jifty->handler->stash->{'in_body'} = $old;
 }
 
 1;


More information about the Jifty-commit mailing list