[web2py] Re: response.files.append in component plugin

2013-07-01 Thread Niphlod
I pointed it out just because modernizer "may be already in your toolbelt". https://github.com/web2py/web2py/blob/master/applications/welcome/views/layout.html#L40 If you excluded it specifically then feel free to reinvent the wheel. On Monday, July 1, 2013 10:38:40 PM UTC+2, RHC wrote: > > Than

[web2py] Re: response.files.append in component plugin

2013-07-01 Thread RHC
Thanks for pointing out that the script won't get cached. I'd better sort that out :-) I didn't know about that modernizr feature, useful to know how it works and what it's for, but that is for another time I think. I will probably skip the modernizr stuff in this component, I use jquery all th

[web2py] Re: response.files.append in component plugin

2013-06-27 Thread Niphlod
Don't reinvent the wheel . if you're using the default layout, you already have in your toolbelt Modernizr. http://modernizr.com/docs/#load If you're not concerned about dipendencies (as it seems from your snippet) it gets really easier. Modernizr.load('/welcome/static/css/bootstrap.min.css

[web2py] Re: response.files.append in component plugin

2013-06-27 Thread Niphlod
getscript will load the file over and over without caching it. On Thursday, June 27, 2013 10:25:10 PM UTC+2, RHC wrote: > > Thanks for your response Anthony and Niphlod. > > For the record I went with dynamically loading css and javascript as > follows: > > /* Load required css dynamically */

[web2py] Re: response.files.append in component plugin

2013-06-27 Thread RHC
Thanks for your response Anthony and Niphlod. For the record I went with dynamically loading css and javascript as follows: /* Load required css dynamically */ function loadcss(path) { if (document.createStyleSheet) {/* check if need to use an IE compatible method */ docum

[web2py] Re: response.files.append in component plugin

2013-06-25 Thread RHC
Niphlod, Thanks, I wasn't aware of these other ways to append these files. That's certainly useful to know. Richard. On Tuesday, June 25, 2013 9:16:35 PM UTC+1, Niphlod wrote: > > response.files gets only called inside web2py_ajax.html, that is evaluated > only when you load the layout.html >

[web2py] Re: response.files.append in component plugin

2013-06-25 Thread Niphlod
response.files gets only called inside web2py_ajax.html, that is evaluated only when you load the layout.html in HTML, all static assets must be in the to be sure all are loaded when you try to execute some code. If you need to include a js file and you're sure all the dependencies are fullf

[web2py] Re: response.files.append in component plugin

2013-06-25 Thread Anthony
The problem is that response.files are inserted in the of the layout, but components are loaded via ajax after the main page has been loaded, so your code will have no effect. You could call response.include_files() after appending the files -- that will insert the relevant code right there in