For now, I added Embed buttons to some of the Bloodhound pages (to be
specific, I put <a> tags with the href pointing to ${href.api('<object>',
<object_id>)} - as Matevz suggested) for easier navigation between the
existing bloodhound pages and the templates I created. I did this because I
am currently working on the JavaScript function that generates an iframe
tag containing the appropriate bh_emb template. But once I finish it, I
think I will use jQuery to insert the buttons into the existing Bloodhound
templates. I might try to use ITemplateStreamFilter, but there is very
little documentation on it and as you said, using JavaScript might be an
easier way to accomplish this.Thanks for the help, Antonia On Sun, Aug 4, 2013 at 7:09 PM, Ryan Ollos <[email protected]> wrote: > On Sun, Aug 4, 2013 at 4:18 AM, Matevž Bradač <[email protected]> wrote: > > > > > On 2. Aug, 2013, at 16:35, Antonia Horincar wrote: > > > > > Hi, > > > > > > Sorry for the late reply. What I want to do is add a link/button on an > > > object's page (for example on a ticket page), which can send the user > to > > a > > > page that has all the information retrieved by my api. For example if I > > > have the page at /products/%40/ticket/1, after accessing the embed > > button, > > > I would be sent to /products/%40/api/ticket/1. I've been trying to > > > understand how can I achieve this and whether I need to use > > > INavigationContributor or not, but I'm still a bit confused. The > > examples I > > > looked at (tickets and relations) are a bit complex and I couldn't > > entirely > > > follow them. > > > > You probably don't need the INavigationContributor, as far as I > understand > > what you're trying to achieve. Take a look at using Href as Ryan > proposed, > > something like > > req.href.api('ticket', ticket_id) > > should do the trick. > > > > You might find examples in the Trac codebase helpful as well. The delete > button on the Report List page (/report) appears to be performing a similar > function to what you are trying to accomplish - sending the user to another > page when clicking on a button. > > > http://trac.edgewall.org/browser/tags/trac-1.0.1/trac/ticket/templates/report_list.html?marks=79#L77 > > In order to attach the button to the existing ticket page, you'll need to > do some work in Genshi via ITemplateStreamFilter, or JavaScript. The > optional TicketDeleter component provided by Trac has an example of how > this could be done in Genshi. TicketDeleter does not currently work with > Bloodhound, but you can try it out in standard instance of Trac or after > disabling the Bloodhound theme. You might find JavaScript to be the easier > way to accomplish this. I don't see any similar examples using JavaScript > in the Trac codebase, but you should be able to find jQuery examples of > generating HTML and inserting it into a page on trac-hacks or elsewhere > around the web. > > > http://trac.edgewall.org/browser/tags/trac-1.0.1/tracopt/ticket/deleter.py#L56 >
