[Jifty-commit] r3981 - jifty/trunk/lib/Jifty/Plugin/TabView

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Aug 25 17:27:59 EDT 2007


Author: clkao
Date: Sat Aug 25 17:27:57 2007
New Revision: 3981

Modified:
   jifty/trunk/lib/Jifty/Plugin/TabView/View.pm

Log:
minor cleanups to the tabview plugin.

Modified: jifty/trunk/lib/Jifty/Plugin/TabView/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/TabView/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/TabView/View.pm	Sat Aug 25 17:27:57 2007
@@ -31,6 +31,11 @@
 
 =cut
 
+sub _tab_path {
+    my ($self, $name) = @_;
+    $self->can('fragment_for') ? $self->fragment_for($name) : "./$name";
+}
+
 sub render_tabs {
     my ($self, $divname, $args, @tabs) = @_;
 
@@ -49,25 +54,24 @@
 				  $tab =~ s/_tab$// ? 
 				  (onclick =>
 				  { region       => Jifty->web->current_region ? Jifty->web->current_region->qualified_name."-$tab-tab" : "$tab-tab",
-				    replace_with => $self->can('fragment_for') ? $self->fragment_for($tab) : "./$tab", # XXX: should have higher level function handling mount point
+				    replace_with => _tab_path($self, $tab), # XXX: should have higher level function handling mount point
 				    args => { map { $_ => get($_)} @$args },
 				  }) : ()
 				 ) }
 	       }
 	   };
 	  div { {class is 'yui-content' };
-      my $default_shown;
+		my $default_shown;
 		for (@tabs) {
 		    div { 
 			if (s/_tab$//) {
 			    render_region(name => $_.'-tab', 
-                          ($default_shown++)? () : ( path => $self->can('fragment_for') ? $self->fragment_for($_) : "./$_",
+                          ($default_shown++)? () : ( path => _tab_path($self, $_),
 						     args =>  { map { $_ => get($_)} @$args })
                           )
 			}
 			else {
-			    die "$self $_" unless $self->has_template("./$_");
-			    $self->has_template($_)->(); 
+			    show( _tab_path($self,$_) );
 			}
 		    }
 		}


More information about the Jifty-commit mailing list