I'm trying to build a Trac plugin around jsGantt (http://www.jsgantt.com).  I'm 
modeling my code on the estimation tools plugin which uses JS for the hours in 
place editor.  My page header has a <script> tag to include the JavaScript but 
the JavaScript doesn't get installed when I install my plugin so the run time 
fails.  I'm clearly missing something.

My setup.py includes:

setup(
    name = 'Trac-jsGantt',
    author = 'Chris Nelson',
    author_email = '[email protected]',
    description = 'Trac plugin displaying jsGantt charts in Trac',
    version = '0.1',
    license='BSD',
    packages=['tracjsgantt'],
    package_data = { 'tracjsgantt': ['htdocs/*.js'] },
    entry_points = {
        'trac.plugins': [
            'tracjsgantt = tracjsgantt'
        ]
    }
)

My development area looks like:

$ find . -name "*.js"
./tracjsgantt/htdocs/jsgantt.js
./tracjsgantt/htdocs/jsgantt.compressed.js
./build/lib/tracjsgantt/htdocs/jsgantt.js
./build/lib/tracjsgantt/htdocs/jsgantt.compressed.js

And in my plugin I have:

class TaacJSGanttSupport(Component):
    implements(IRequestFilter)
    
    # IRequestFilter methods
    def pre_process_request(self, req, handler):
        # I think we should look for a TracJSGantt on the page and set
        # a flag for the post_process_request handler if found
        return handler
            
    def post_process_request(self, req, template, data, content_type):
        add_script(req, '/tracjsgantt/jsgantt.js')
        add_stylesheet(req, '/tracjsgantt/jsgantt.css')
        return template, data, content_type

(I've tried that with and without the leading / in the names.)

When I run this, the HTML includes:

  <script type="text/javascript" src="/trac/tracjsgantt/jsgantt.js"></script>

But looking for jsgantt.js in my Trac environment finds no files.  If I 
manually copy it where I think it should be, it still doesn't work.

Is there something wrong with my code?  When looking for scripts and style 
sheets, what is /trac?  How do I make my setup process put files there?  
Shouldn't setup put it in the egg?

TIA.

                                          Chris
-- 
Christopher Nelson, Software Engineering Manager
SIXNET - Solutions for Your Industrial Networking Challenges
331 Ushers Road, Ballston Lake, NY  12019
Tel: +1.518.877.5173, Fax: +1.518.877.8346 www.sixnet.com 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to