response.menu args

1,044 views
Skip to first unread message

lyn2py

unread,
Sep 19, 2012, 11:55:08 AM9/19/12
to web...@googlegroups.com
Hi guys,

This is a typical code
response.menu = [
    (T('Home'), False, URL('default','index'), [])
    ]

I would like to ask, what does the 2nd arg, "False" actually refer to?
I tried changing it to True but it didn't seem to have any effect on the menu.
I tried a quick search on the manual and the groups, but didn't manage to find out. 

Thanks for the quick help!

Paolo Caruccio

unread,
Sep 19, 2012, 1:40:13 PM9/19/12
to web...@googlegroups.com

lyn2py

unread,
Sep 19, 2012, 10:53:25 PM9/19/12
to web...@googlegroups.com
Thanks Paolo!

Robin Manoli

unread,
Apr 17, 2013, 4:34:32 PM4/17/13
to web...@googlegroups.com
The second argument here tells whether this menu item is active or not. Setting this to true adds the class="web2py-menu-active" to the li of the menu-item.

Unfortunately though, this class is not implemented by default in web2py, and nor is the argument set to (request.function=='index') which would be more pedagogic. However, since the default menu is made in twitter bootstrap, it would be neater to use bootstrap's own active class, which is simply named "active".

How can I change the current line of code to set the active class to "active" instead of "web2py-menu-active"?
The current menu code in layout.html is:
{{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 'nav',mobile=is_mobile,li_class='dropdown',ul_class='dropdown-menu')}}
Reply all
Reply to author
Forward
0 new messages