You would put that JS in a Genshi text template and use the normal URL
building stuff. Really we should probably export some more stuff to make
that easy (like a JS version of the Href object).

--Noah

> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Jeff Hammel
> Sent: Friday, September 12, 2008 1:26 PM
> To: [email protected]
> Subject: [Trac-dev] Re: Referencing URLs in JS
> 
> 
> On Fri, Sep 12, 2008 at 10:43:30AM -0700, Noah Kantrowitz wrote:
> >
> > add_script(req, req.href.users(req.path_info != '/newticket' and
> > req.path_info[8:] or None))
> >
> > --Noah
> 
> I'm not sure if this does what I want, which is refer to URLs in the
> JS.  Right now I have:
> 
> > autocomplete_newticket_cc.js:
> 
> $(document).ready(function() {
>                            $("#field-cc").autocomplete("users", {
>                            multiple: true,
>                            formatItem: formatItem});
> });
> 
> > autocomplete_ticket_cc.js:
> 
> $(document).ready(function() {
>                            $("#field-cc").autocomplete("../users", {
>                            multiple: true,
>                            formatItem: formatItem});
> 
> });
> 
> Will the above method resolve the difference between "users" and
> "../users"?  I don't see how but maybe I'm too dumb to see it.
> 
> Jeff Hammel
> The Open Planning Project
> http://topp.openplans.org
> 
> > > -----Original Message-----
> > > From: [email protected] [mailto:[EMAIL PROTECTED]
> On
> > > Behalf Of Jeff Hammel
> > > Sent: Friday, September 12, 2008 9:25 AM
> > > To: [email protected]
> > > Subject: [Trac-dev] Referencing URLs in JS
> > >
> > >
> > > I'm working on a plugin (which I also intend to propose as a patch)
> > > that will autocomplete users on ticket fields (assign to, CC) via
> AJAX.
> > > I've created a request handler for '/users' which returns user
> > > information in the format that I need.  But I'm not sure if there
> is a
> > > good way to specify this URL in JS.  For '/newticket' I can use
> > > 'users', but for '/ticket/1' I have to use '../users', which leads
> to
> > > the necessity of either having two JS files with similar contents
> > > (maybe not horrible) or generating the JS dynamically.
> > >
> > > I can't use '/users' AFAIK as the absolute link should be
> > > '/myprojectname/users'.  Is there a way around this in trac?  Or is
> > > dynamically generating the JS the only approach here?
> > >
> > > Jeff Hammel
> > > The Open Planning Project
> > > http://topp.openplans.org
> > > IRC: jhammel, k0s
> > >
> > >
> >
> >
> > >
> 
> 


--~--~---------~--~----~------------~-------~--~----~
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