My fault. There should be one more modification. diff -r 04673c0ce6ab views/layout.html --- a/views/layout.html Tue Dec 27 01:29:01 2011 +0800 +++ b/views/layout.html Tue Dec 27 01:29:17 2011 +0800 @@ -39,8 +39,10 @@
{{#------ require CSS and JS files for this page (read info in base.css) ------}} {{response.files.append(URL('static','css/base.css'))}} - {{response.files.append(URL('static','css/superfish.css'))}} - {{response.files.append(URL('static','js/superfish.js'))}} + {{if response.menu:}} + {{response.files.append(URL('static','css/superfish.css'))}} + {{response.files.append(URL('static','js/superfish.js'))}} + {{pass}} {{#------ include web2py specific js code (jquery, calendar, form stuff) ------}} {{include 'web2py_ajax.html'}} @@ -88,13 +90,14 @@ <div id="statusbar"><!-- statusbar is menu zone --> {{block statusbar}} <!-- this is default statusbar --> - {{#------ superfish menu ------}} - <style>li.current {background:white; /* #BDD2FF; */}</style> - {{=MENU(response.menu,_class='sf-menu',li_active='current')}} - <script type="text/javascript"> - jQuery(document).ready(function(){ - jQuery('ul.sf-menu').superfish();}); - </script> + {{if response.menu:}}{{#------ superfish menu ------}} + <style>li.current {background:white; /* #BDD2FF; */}</ style> + {{=MENU(response.menu,_class='sf- menu',li_active='current')}} + <script type="text/javascript"> + jQuery(document).ready(function(){ + jQuery('ul.sf-menu').superfish();}); + </script> + {{pass}} <div style="clear: both;"></div><!-- Clear the divs --> {{end}} </div><!-- statusbar --> On Dec 27, 12:31 am, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote: > good idea. In trunk! > > On Dec 26, 9:32 am, "Ray (a.k.a. Iceberg)" <iceb...@21cn.com> wrote: > > > > > > > > > Hey folks, > > > I just use this little trick in my app, to reduce two unnecessary http > > requests when menus are not needed. > > > I think the optimization is reasonable. And people can always manually > > re-enable superfish by response.files.extend([...]). So, my proposal > > is to put this into the default welcome (scaffold) app. Shall we? > > > diff -r 483ebd275b49 views/layout.html > > --- a/views/layout.html Mon Dec 26 23:19:42 2011 +0800 > > +++ b/views/layout.html Mon Dec 26 23:26:26 2011 +0800 > > @@ -39,8 +39,10 @@ > > > {{#------ require CSS and JS files for this page (read info in > > base.css) ------}} > > {{response.files.append(URL('static','css/base.css'))}} > > - {{response.files.append(URL('static','css/superfish.css'))}} > > - {{response.files.append(URL('static','js/superfish.js'))}} > > + {{if response.menu:}} > > + {{response.files.append(URL('static','css/superfish.css'))}} > > + {{response.files.append(URL('static','js/superfish.js'))}} > > + {{pass}} > > {{#------ include web2py specific js code (jquery, calendar, form > > stuff) ------}} > > {{include 'web2py_ajax.html'}}