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

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


Author: ruz
Date: Sun May 11 22:50:28 2008
New Revision: 5459

Modified:
   jifty/trunk/lib/Jifty/Mason/Halo.pm
   jifty/trunk/lib/Jifty/Plugin/Halo.pm

Log:
* add is_proscribed method into Halo plugin

Modified: jifty/trunk/lib/Jifty/Mason/Halo.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Mason/Halo.pm	(original)
+++ jifty/trunk/lib/Jifty/Mason/Halo.pm	Sun May 11 22:50:28 2008
@@ -39,7 +39,7 @@
         proscribed   => $self->_unrendered_component($context) ? 1 : 0,
     );
 
-    return if $self->_unrendered_component($context);
+    return if Jifty::Plugin::Halo->is_proscribed( $frame );
 
     $context->request->out(Jifty::Plugin::Halo->halo_header($frame));
 }
@@ -58,15 +58,8 @@
     return if ($context->comp->path || '') eq "/__jifty/halo";
 
     my $frame = Jifty::Plugin::Halo->pop_frame;
-
-    return if $self->_unrendered_component($context);
-
-    # print out the div with our halo magic actions.
-    # if we didn't render a beginning of the span, don't render an end
-    unless ( $frame->{'proscribed'} ) {
-        my $comp_name = $frame->{'path'};
-        $context->request->out(Jifty::Plugin::Halo->halo_footer($frame));
-    }
+    return if Jifty::Plugin::Halo->is_proscribed( $frame );
+    $context->request->out(Jifty::Plugin::Halo->halo_footer($frame));
 }
 
 =head2 _unrendered_component CONTEXT
@@ -81,14 +74,7 @@
 sub _unrendered_component {
     my $self    = shift;
     my $context = shift;
-    if (   $context->comp->is_subcomp()
-        or not Jifty->handler->stash->{'in_body'})
-    {
-        return 1;
-    } else {
-        return undef;
-    }
-
+    return $context->comp->is_subcomp ? 1 : 0; 
 }
 
 =head2 render_component_tree

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:50:28 2008
@@ -290,4 +290,13 @@
     return $frame;
 }
 
+sub is_proscribed {
+    my ($self, $frame) = @_;
+    return 1 if $frame->{'proscribed'};
+
+    $frame->{'proscribed'} = 1 unless Jifty->handler->stash->{'in_body'};
+
+    return $frame->{'proscribed'}? 1 : 0;
+}
+
 1;


More information about the Jifty-commit mailing list