You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Kanze <pe...@gmail.com> on 2009/03/20 13:34:04 UTC
T5: Navigation Component with Active style, How?
Hello
I have a component at the top of the page for navigating to my "main"
pages..
This works perfect, see the xhtml code below.. But the problem is that I
want the clicked navigate link to get an class="active" attribute.
How can I do this? The problem is the component is rerendered after I click
a navigate link. And I don't want to store something in the session..
Any Ideas?
Thanks!
Peter
<!-- Generated Navigation component xhtml-->
<div id="header">
<ul id="navigation">
<li>
<a t:type="pagelink" page="Index" class="active">
<span>${message:tab-index}</span>
</a>
</li>
<li>
<a t:type="pagelink" page="Profile">
<span>${message:tab-profile}</span>
</a>
</li>
<li>
<a t:type="pagelink" page="Chart">
<span>${message:tab-chart}</span>
</a>
</li>
<li>
<a t:type="pagelink" page="Search">
<span>${message:tab-search}</span>
</a>
</li>
</ul>
</div>
Re: T5: Navigation Component with Active style, How?
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, Mar 20, 2009 at 11:12 AM, Peter Kanze <pe...@gmail.com> wrote:
> Hello,
Hi!
> The a:visited is not an option because only one tab button can be active.
Ok!
> About the mixin solution, how can I check the requested URL in my mixin?
> Do you have a quick example?
Inject the Request and use its getPath() method:
@Inject
private Request request;
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Navigation Component with Active style, How?
Posted by Peter Kanze <pe...@gmail.com>.
Hello,
The a:visited is not an option because only one tab button can be active.
About the mixin solution, how can I check the requested URL in my mixin?
Do you have a quick example?
Thanks!
Peter
On Fri, Mar 20, 2009 at 1:38 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:
> On Fri, Mar 20, 2009 at 9:34 AM, Peter Kanze <pe...@gmail.com> wrote:
> > I have a component at the top of the page for navigating to my "main"
> > pages..
> > This works perfect, see the xhtml code below.. But the problem is that I
> > want the clicked navigate link to get an class="active" attribute.
>
> Doesn't using CSS's a:visited selector solve your problem?
> Other solution would be some JavaScript that inspects each <a> tag and
> compares its href attribute to the requested URL. If they match, you
> add the class attribute. This could be implemented as a mixin . . .
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: T5: Navigation Component with Active style, How?
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, Mar 20, 2009 at 9:34 AM, Peter Kanze <pe...@gmail.com> wrote:
> I have a component at the top of the page for navigating to my "main"
> pages..
> This works perfect, see the xhtml code below.. But the problem is that I
> want the clicked navigate link to get an class="active" attribute.
Doesn't using CSS's a:visited selector solve your problem?
Other solution would be some JavaScript that inspects each <a> tag and
compares its href attribute to the requested URL. If they match, you
add the class attribute. This could be implemented as a mixin . . .
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org