good idea. In trunk!

On Dec 26, 9:32 am, "Ray (a.k.a. Iceberg)" <[email protected]> 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'}}

Reply via email to