[Jifty-commit] jifty branch, master, updated. dac4d6b131b041b6735ec2d1a9cc17c8c9646a63

Jifty commits jifty-commit at lists.jifty.org
Mon Jan 11 20:51:45 EST 2010


The branch, master has been updated
       via  dac4d6b131b041b6735ec2d1a9cc17c8c9646a63 (commit)
      from  e741bf0e011349bc0fc0e94c91c89564d60b4695 (commit)

Summary of changes:
 lib/Jifty/Web/Menu.pm |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit dac4d6b131b041b6735ec2d1a9cc17c8c9646a63
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Jan 11 20:51:28 2010 -0500

    Add a beforeshow JS hook for the YUI menu

diff --git a/lib/Jifty/Web/Menu.pm b/lib/Jifty/Web/Menu.pm
index 946ee5b..8a97172 100644
--- a/lib/Jifty/Web/Menu.pm
+++ b/lib/Jifty/Web/Menu.pm
@@ -433,6 +433,11 @@ A hashref of options passed directly to the Javascript constructor for
 the menu.  See L<http://developer.yahoo.com/yui/menu/#configreference> for
 a list of the options available.
 
+=item beforeshow
+
+A string of Javascript to run immediately before the menu is shown.  The
+variable C<menu> is available and represents the current YUI Menu object.
+
 =back
 
 =cut
@@ -443,6 +448,7 @@ sub render_as_yui_menu {
         id      => Jifty->web->serial,
         show    => 1,
         options => {},
+        beforeshow => '',
         @_
     );
 
@@ -464,8 +470,6 @@ sub render_as_yui_menu {
                     if ( !this.cfg.getProperty("constraintoviewport") )
                         Jifty.Utils.scrollToShow(this.id);
                 });
-                $showjs
-
                 if ( $binding ) {
                     YAHOO.util.Event.addListener("$args{button}", "click",
                         function() {
@@ -476,6 +480,8 @@ sub render_as_yui_menu {
                     menu.subscribe("show", function() { if (!this.parent) jQuery("#$args{button}").addClass("open") });
                     menu.subscribe("hide", function() { if (!this.parent) jQuery("#$args{button}").removeClass("open") });
                 }
+                $args{beforeshow}
+                $showjs
             });
         </script>
     END

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


More information about the Jifty-commit mailing list