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.

--
matevz

> 
> Thanks,
> Antonia
> 
> 
> On Thu, Aug 1, 2013 at 4:29 AM, Ryan Ollos <[email protected]> wrote:
> 
>> On Wed, Jul 31, 2013 at 4:40 PM, Antonia Horincar <
>> [email protected]> wrote:
>> 
>>> Hi,
>>> 
>>> Thank you for your reply. I just realised I misunderstood what
>>> INavigatonContributor does. And my new question is how can I add a new
>>> action to tickets? But I'm not even sure if adding a new action would be
>> a
>>> solution in this case.
>>> 
>> 
>> You would like to add an action to the workflow? For that you would need to
>> implement `ITicketActionController` in trac.ticket.api.
>> 
>> I'm not up to speed on what you are doing as much as I'd like since I've
>> been busy pushing fixes to Trac lately. If you give some more details on
>> what you are trying to accomplish we can probably point you in the right
>> direction.
>> 
>> 
>>> I'm also trying to understand how the Href class works, but I don't know
>>> how can I use it to send data about the resource's type and its id/name
>> to
>>> my api.
>>> 
>> 
>> The Href class is used to construct an href string from variables in
>> Python. It a utility for constructing relative and absolute URLs. Are you
>> trying to construct an href that points to an external resource?
>> 

Reply via email to