[Jifty-commit] r4017 - in jifty/trunk: lib/Jifty/Web

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Aug 30 22:26:54 EDT 2007


Author: sterling
Date: Thu Aug 30 22:26:52 2007
New Revision: 4017

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Menu.pm

Log:
 r11089 at riddle:  andrew | 2007-08-30 21:26:36 -0500
 Making Jifty::Web::Menu more extensible.


Modified: jifty/trunk/lib/Jifty/Web/Menu.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Menu.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Menu.pm	Thu Aug 30 22:26:52 2007
@@ -112,14 +112,16 @@
 sub child {
     my $self = shift;
     my $key = shift;
+    my $proto = ref $self || $self;
+
     if (@_) {
-        $self->{children}{$key} = Jifty::Web::Menu->new({parent => $self,
-                                                        sort_order => ($self->{children}{$key}{sort_order}
-                                                                       || scalar values %{$self->{children}}),
-                                                        label => $key,
-                                                        escape_label => 1,
-                                                        @_
-                                                       });
+        $self->{children}{$key} = $proto->new({parent => $self,
+                                               sort_order => ($self->{children}{$key}{sort_order}
+                                                          || scalar values %{$self->{children}}),
+                                               label => $key,
+                                               escape_label => 1,
+                                               @_
+                                             });
         Scalar::Util::weaken($self->{children}{$key}{parent});
         # Activate it
         if (my $url = $self->{children}{$key}->url and Jifty->web->request) {


More information about the Jifty-commit mailing list