You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ZKN __ <zk...@abv.bg> on 2012/07/26 14:12:23 UTC

relative page links in components

Hi,
I have a component that's to be included in different pages. Inside the component I have page links that need to be relative to the current page.
Something like this:
<t:pagelink class="btn" page="./Edit" context="[ID]">
							<span><span>${message:edit}</span></span>
						</t:pagelink>
The page link should point to different pages according to the current page.
Is that possible?


Thanks,
Özkan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: relative page links in components

Posted by Howard Lewis Ship <hl...@gmail.com>.
This will not work, at least, not always. It certainly won't understand about page activation context.

Sent from my iPad

On Jul 26, 2012, at 9:37 AM, Alex Kotchnev <ak...@gmail.com> wrote:

> Ozkan - just an idea - it seems that you might be able to do something like
> this :
> 
> @Inject
> private ComponentResources compResources
> 
> @Property
> String editPath
> 
> page = compResources.getPage()
> editPath =
> page.getComponentResources().getBaseResource().forPath("edit").getPath()
> 
> then, in your component, you'd use something like this :
> <t:pageLink t:page="prop:editPath">Edit</t:pageLink>
> 
> And of course, this is totally not tested or guaranteed to work - I'm just
> looking at the API (
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/ComponentResources.html
> ).
> 
> Cheers,
> 
> Alex K
> 
> On Thu, Jul 26, 2012 at 8:12 AM, ZKN __ <zk...@abv.bg> wrote:
> 
>> 
>> Hi,
>> I have a component that's to be included in different pages. Inside the
>> component I have page links that need to be relative to the current page.
>> Something like this:
>> <t:pagelink class="btn" page="./Edit" context="[ID]">
>> 
>> <span><span>${message:edit}</span></span>
>>                                                </t:pagelink>
>> The page link should point to different pages according to the current
>> page.
>> Is that possible?
>> 
>> 
>> Thanks,
>> Özkan
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: relative page links in components

Posted by Alex Kotchnev <ak...@gmail.com>.
Ozkan - just an idea - it seems that you might be able to do something like
this :

@Inject
private ComponentResources compResources

@Property
String editPath

page = compResources.getPage()
editPath =
page.getComponentResources().getBaseResource().forPath("edit").getPath()

then, in your component, you'd use something like this :
<t:pageLink t:page="prop:editPath">Edit</t:pageLink>

And of course, this is totally not tested or guaranteed to work - I'm just
looking at the API (
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/ComponentResources.html
 ).

Cheers,

Alex K

On Thu, Jul 26, 2012 at 8:12 AM, ZKN __ <zk...@abv.bg> wrote:

>
> Hi,
> I have a component that's to be included in different pages. Inside the
> component I have page links that need to be relative to the current page.
> Something like this:
> <t:pagelink class="btn" page="./Edit" context="[ID]">
>
> <span><span>${message:edit}</span></span>
>                                                 </t:pagelink>
> The page link should point to different pages according to the current
> page.
> Is that possible?
>
>
> Thanks,
> Özkan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: relative page links in components

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 26 Jul 2012 09:12:23 -0300, ZKN __ <zk...@abv.bg> wrote:

> Hi,

Hi!

> I have a component that's to be included in different pages. Inside the  
> component I have page links that need to be relative to the current page.
> Something like this:
> <t:pagelink class="btn" page="./Edit" context="[ID]">
> 							<span><span>${message:edit}</span></span>
> 						</t:pagelink>
> The page link should point to different pages according to the current  
> page.
> Is that possible?

Before answering that, I'd like to know why you need this, what are you  
trying to accomplish. Without further information, I see no reason for  
using relative paths in Tapestry applications.

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org