[Jifty-commit] jifty branch, master, updated. jifty-1.01209-21-gde03c4d

Jifty commits jifty-commit at lists.jifty.org
Tue Feb 1 16:01:26 EST 2011


The branch, master has been updated
       via  de03c4d51f50a02f342ec8d7857b0612f336519e (commit)
       via  a20b4831ce18d28cd2e8f1a8ef9530d299db20cf (commit)
       via  c50304961b16b15c3a95cce5de682e0e4bf785d8 (commit)
      from  a3711b7966d63de687dafbe2b7f70f47d13d7ce5 (commit)

Summary of changes:
 lib/Jifty/Plugin/ViewDeclarePage/Page.pm |    4 ++-
 lib/Jifty/Web/Menu.pm                    |   31 ++++++++++++++++++++++++-----
 2 files changed, 28 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit c50304961b16b15c3a95cce5de682e0e4bf785d8
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Feb 1 15:32:55 2011 -0500

    Make sure the submenu <ul> has the submenu class
    
    Our CSS in nav.css expects the submenu class.

diff --git a/lib/Jifty/Web/Menu.pm b/lib/Jifty/Web/Menu.pm
index 0508b89..91fa6ae 100644
--- a/lib/Jifty/Web/Menu.pm
+++ b/lib/Jifty/Web/Menu.pm
@@ -345,7 +345,7 @@ sub render_submenu {
     my %args = ( id => '', @_ );
 
     my $web = Jifty->web;
-    $web->out(qq(<ul id="$args{id}">));
+    $web->out(qq(<ul id="$args{id}" class="submenu">));
     for ($self->children) {
         $web->out(qq{<li class="submenu }.($_->active ? 'active' : '' ).' '. ($_->class || "").qq{">});
 

commit a20b4831ce18d28cd2e8f1a8ef9530d299db20cf
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Feb 1 15:55:51 2011 -0500

    Add a deep_active option to render active menu items all the way down

diff --git a/lib/Jifty/Plugin/ViewDeclarePage/Page.pm b/lib/Jifty/Plugin/ViewDeclarePage/Page.pm
index 08848eb..cffbd4e 100644
--- a/lib/Jifty/Plugin/ViewDeclarePage/Page.pm
+++ b/lib/Jifty/Plugin/ViewDeclarePage/Page.pm
@@ -542,8 +542,10 @@ Called from L</render_page>.
 =cut
 
 sub render_navigation {
+    my $self = shift;
+    my @args = @_;
     div { attr { id => "navigation" };
-        Jifty->web->navigation->render_as_menu;
+        Jifty->web->navigation->render_as_menu(@args);
     };
     return '';
 }
diff --git a/lib/Jifty/Web/Menu.pm b/lib/Jifty/Web/Menu.pm
index 91fa6ae..5ea9439 100644
--- a/lib/Jifty/Web/Menu.pm
+++ b/lib/Jifty/Web/Menu.pm
@@ -269,6 +269,8 @@ sub children {
 Render this menu with HTML markup as multiple dropdowns, suitable for
 an application's menu
 
+Any arguments are passed to L<render_as_hierarchical_menu_item>.
+
 =cut
 
 sub render_as_menu {
@@ -277,7 +279,7 @@ sub render_as_menu {
     Jifty->web->out(qq{<ul class="menu">});
 
     for (@kids) {
-        $_->render_as_hierarchical_menu_item();
+        $_->render_as_hierarchical_menu_item(@_);
     }
     Jifty->web->out(qq{</ul>});
     '';
@@ -303,6 +305,8 @@ Render an <li> for this item. suitable for use in a regular or contextual
 menu. Currently renders one level of submenu, if it exists, using
 L</render_submenu>.
 
+Any arguments are passed to L<render_submenu>.
+
 =cut
 
 sub render_as_hierarchical_menu_item {
@@ -324,7 +328,7 @@ sub render_as_hierarchical_menu_item {
             qq{<span class="expand"><a href="#" onclick="Jifty.ContextMenu.hideshow('}
                 . $id
                 . qq{'); return false;">&nbsp;</a></span>} );
-        $self->render_submenu( id => $id );
+        $self->render_submenu( %args, id => $id );
     }
     $web->out(qq{</li>});
     '';
@@ -338,11 +342,18 @@ suitable for use as part of a regular or contextual menu.  Called by
 L</render_as_hierarchical_menu_item>. You probably don't need to use this
 on it's own.
 
+If passed C<deep_active => 1>, then it renders active descendants recursively
+all the way down.
+
 =cut
 
 sub render_submenu {
     my $self = shift;
-    my %args = ( id => '', @_ );
+    my %args = (
+        id => '',
+        deep_active => 0,
+        @_
+    );
 
     my $web = Jifty->web;
     $web->out(qq(<ul id="$args{id}" class="submenu">));
@@ -353,6 +364,11 @@ sub render_submenu {
         # Either stringify the link object or output the label
         # This is really icky. XXX TODO
         $web->out( $_->as_link );
+    
+        if ($args{'deep_active'} and $_->active and $_->children) {
+            $_->render_submenu( %args, id => $web->serial );
+        }
+
         $web->out("</li>");
     }
     $web->out(qq{</ul>});

commit de03c4d51f50a02f342ec8d7857b0612f336519e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Feb 1 16:00:45 2011 -0500

    Add an option to kill the JS expand spans
    
    Incidentally, this removes the never used default class => ''.

diff --git a/lib/Jifty/Web/Menu.pm b/lib/Jifty/Web/Menu.pm
index 5ea9439..fc2f728 100644
--- a/lib/Jifty/Web/Menu.pm
+++ b/lib/Jifty/Web/Menu.pm
@@ -305,6 +305,8 @@ Render an <li> for this item. suitable for use in a regular or contextual
 menu. Currently renders one level of submenu, if it exists, using
 L</render_submenu>.
 
+If you pass C<expand => 0>, the javascript expansion C<span> won't be output.
+
 Any arguments are passed to L<render_submenu>.
 
 =cut
@@ -312,7 +314,7 @@ Any arguments are passed to L<render_submenu>.
 sub render_as_hierarchical_menu_item {
     my $self = shift;
     my %args = (
-        class => '',
+        expand => 1,
         @_
     );
     my @kids = $self->children;
@@ -327,7 +329,8 @@ sub render_as_hierarchical_menu_item {
         $web->out(
             qq{<span class="expand"><a href="#" onclick="Jifty.ContextMenu.hideshow('}
                 . $id
-                . qq{'); return false;">&nbsp;</a></span>} );
+                . qq{'); return false;">&nbsp;</a></span>} )
+            if delete $args{'expand'};
         $self->render_submenu( %args, id => $id );
     }
     $web->out(qq{</li>});

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list