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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Jan 18 06:47:22 EST 2008


Author: sartak
Date: Fri Jan 18 06:47:13 2008
New Revision: 4879

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

Log:


Modified: jifty/trunk/lib/Jifty/Web/Menu.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Menu.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Menu.pm	Fri Jan 18 06:47:13 2008
@@ -4,7 +4,9 @@
 use URI;
 use Scalar::Util qw(weaken);
 
-__PACKAGE__->mk_accessors(qw(label _parent sort_order link target escape_label class group));
+__PACKAGE__->mk_accessors(qw(
+    label _parent sort_order link target escape_label class group group_heading
+));
 
 =head1 NAME
 
@@ -89,6 +91,11 @@
 Gets or sets the menu group this menu item is in.  Only used when rendering
 as a YUI menubar for now.  Groups are sorted by this value as well.
 
+=head2 group_heading [BOOLEAN]
+
+Gets or sets the menu group's heading that this item is in.  Only used when
+rendering as a YUI menubar for now.  May be a link, url, or just a label.
+
 =head2 url
 
 Gets or sets the URL that the menu's link goes to.  If the link
@@ -393,8 +400,14 @@
     );
     my $count = 1;
     for my $group ( @grouped ) {
+        for ( grep { $_->group_heading } @$group ) {
+            Jifty->web->out(qq(<h6 class="@{[ $_->active ? 'active' : '' ]}">));
+            Jifty->web->out( $_->as_link );
+            Jifty->web->out('</h6>');
+        }
+        
         Jifty->web->out( $count == 1 ? '<ul class="first-of-type">' : '<ul>' );
-        for ( @$group ) {
+        for ( grep { not $_->group_heading } @$group ) {
             Jifty->web->out( qq{<li class="${class}item }
             . ($_->active? 'active' : '') . qq{">});
             Jifty->web->out( $_->as_link );


More information about the Jifty-commit mailing list