sub sub menu in newest version

478 views
Skip to first unread message

黄祥

unread,
Apr 26, 2015, 7:18:53 AM4/26/15
to web...@googlegroups.com
hi,

i realize that web2py sub sub menu in newest version is not work as expected (no error occured but the result is not expected).
models/menu.py
response.menu = [
(T('Menu'), False, URL('default', 'index'), [
(T('Sub Menu 1'), False, URL('default', 'index'), [
(T('Sub Menu 2'), False, URL('default', 'index'), []),
]),
]), 
]

result in html browser
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a href="/test/default/index">Sub Menu 1</a>
<ul class="dropdown-menu">
<li>
<a href="/test/default/index">Sub Menu 2</a>
</li>
</ul>
</li>
</ul>

how can i have the sub sub menu in web2py newest version? the previous version (bootstrap 2) is worked as expected

thanks and best regards,
stifan

Leonardo Pires Felix

unread,
Apr 26, 2015, 8:59:00 AM4/26/15
to web...@googlegroups.com
Nested menus are not implemented in bootstrap 3.
What you could do is add this piece of code to your layout.html
< style>

      .dropdown-submenu{position:relative;}

.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0
 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px
6px;}

.dropdown-submenu:hover>.dropdown-menu{display:block;}

.dropdown-submenu>a:after{display:block;content:"
";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px
 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;}

.dropdown-submenu:hover>a:after{border-left-color:#ffffff;}

.dropdown-submenu.pull-left{float:none;}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px
 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px
6px;}

< /style>

as sugested by HarryR7 web2py github issues

Niphlod

unread,
Apr 26, 2015, 3:52:49 PM4/26/15
to web...@googlegroups.com
this would be the last time I post on the subject: hopefully new readers will accept things as they are and live happily ever after.......

bootstrap3 DOESN'T (and probably won't ever, if you followed its development closely) support any menu that goes as far as the 3rd level.
ANY snippet of code you find around the internet has issues either on large screens or in narrow ones, displays ugly scrollbars, doesn't work with touch, scales ugly, etc etc etc.
If you adopt bootstrap3 you NEED to revisit your menu structure to comply with bs3 fundamentals, that, summed up, is that ultra-nested navigation menus are BAD in 2015, when more than the half of the users visiting your site are not using a mouse and have a narrow screen.

黄祥

unread,
Apr 26, 2015, 8:49:35 PM4/26/15
to web...@googlegroups.com
thanks all for the pointers and explaination.

best regards,
stifan

Rakesh Singh

unread,
Jul 20, 2015, 5:02:03 PM7/20/15
to web...@googlegroups.com
Hi

Apologies for resurrecting an old topic, but I have not used web2py in quite a while and found myself asking the same question.

The application I intend to create needs to have 3rd level menus (perhaps even 4th)
Without it, my menu structure will be a real mess and there would be no way to logically group menu items making it would be difficult for the user to even find the option.
(This is a large application!)
All users are PC users on the LAN/WAN, so we don't care about mobile support.
What would be the recommended way to implement this with the current web2py?

Thank you...

黄祥

unread,
Jul 28, 2015, 6:08:08 PM7/28/15
to web2py-users, r...@verifaction.co.za
i think you can stick with the old web2py layout (css and js) and use the new version of web2py (pydal, etc)

best regards,
stifan
Reply all
Reply to author
Forward
0 new messages