Forwarding this message for the discussion:
----- Forwarded message from Nikolaus Wittenstein <[EMAIL PROTECTED]> -----
From: Nikolaus Wittenstein <[EMAIL PROTECTED]>
Subject: Fwd: [Trac-dev] Referencing URLs in JS
To: [EMAIL PROTECTED]
Date: Fri, 12 Sep 2008 12:58:08 -0400
For some reason it won't let me actually post to the group, so here's the
message I was trying to send.
-Nikolaus
---------- Forwarded message ----------
From: Nikolaus Wittenstein <[EMAIL PROTECTED]>
Date: Fri, Sep 12, 2008 at 12:53
Subject: Re: [Trac-dev] Referencing URLs in JS
To: [EMAIL PROTECTED]
In a plugin I wrote, I put a <div> like this at the bottom of the page:
<div id="ajaxurl"
style="display:none;">${href.updates('ajaxSaveTableChange')}</div>
Then I used Javascript and getElementById (well, really I use
$('#ajaxurl').text(), but either will work) to read the url that Genshi
made for me. In this way, the Javascript itself doesn't have to be
dynamic, but the URL can still be.
Similarly, you could use some sort of postprocessor or something to add
such a div to pages if you didn't want to edit templates directly.
Also, if anyone has a better approach, I'd be interested as well.
-Nikolaus
On Fri, Sep 12, 2008 at 12:25, Jeff Hammel <[EMAIL PROTECTED]>
wrote:
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
[4]http://topp.openplans.org
IRC: jhammel, k0s
References
Visible links
1. mailto:[EMAIL PROTECTED]
2. mailto:[email protected]
3. mailto:[EMAIL PROTECTED]
4. http://topp.openplans.org/
5. mailto:[email protected]
6. mailto:[EMAIL PROTECTED]
7. http://groups.google.com/group/trac-dev?hl=en
----- End forwarded message -----
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---