Re: Including javascript code
"John P. Rouillard" <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Tom: In message <CO3PR08MB79574084B49D67DF4480F9CACAEA9@CO3PR08MB7957.namprd08.prod. outlook.com>, Tom Ekberg writes: >I have JavaScript code that I put in html/page.html but it is >getting a bit large. I put the following in the <head> section of >html/page.html > ><script type="text/javascript" src="foo.js"></script> You want src="@@file/foo.js" which will load the file <tracker_home>/html/foo.js. >Foo.js does nothing but an alert. I put the foo.js file in the top level >(same level as schema.py) and in html/. All I get is a HTTP 404 error. Yup files served up via the web are all under html and need the @@file prefix. https://www.roundup-tracker.org/docs/customizing.html#roundup-url-design >What is the recommended place to put javascript files and what is the >script src attribute to load it into page.html? A src="@@file/foo.js" with tracker URL of: https://example.com/tracker/ will show your browser do a GET for https://example.com/tracker/@@file/foo.js which is <tracker_home>/html/foo.js. If you put the file under: <tracker_home>/html/javascript/foo.js then your src should be: src="@@file/javascript/foo.js" For my trackers, I have <tracker_home>/html/jslibraries/... where subdirectories hold libraries like jquery, Sortable etc. This differentiates them from javascript that is locally produced js. There is no preferred layout except that assets served from the web interface are all relative to the html directory. I am assuming you are serving the file via roundup rather than having an upstream web server or wsgi server serve static assets directly. If you do have a server serving up static assets directly, the subdirectory structure is probably prefered to allow you to directly serve anything in a subdirectory. Have a great week. -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions.