Converting anchors to action in topbar-menu

Post Reply
jblaplace
Posts: 3
Joined: 29 Sep 2016, 01:55

05 Oct 2016, 05:14

Hello,

I'm trying to replace the anchor(s) in topbar-menu (within topbar.xhtml) so that I can link an action on click.
I though of using p:commandLink but I find I have to override the color style in line otherwise the link comes out blue (I use the apollo-blue theme)

For example, I'm trying to replace something like the following that comes out as off-white:
<a href="#"><span class="topbar-item-text">Settings</span><span class="topbar-icon fa fa-gear"></span></a>

By:
<p:commandLink action="#{logoutBean.logout}" style="color : #d8d8d8;">
<a href="#"><span class="topbar-item-text">Logout</span><span class="topbar-icon fa fa-sign-out"></span></a>
</p:commandLink>

If I don't put the style="color : #d8d8d8;" the link comes out blue (apollo blue)
Is there another way of achieving what I want to do without overriding the color ?

Thanks.

JB

User avatar
aragorn
Posts: 2366
Joined: 29 Jun 2013, 12:38

06 Oct 2016, 12:09

I think you can use jsf:action with JSF2.2 instead of p:* and h:* components(p:commandButton, h:commandLink, ..) in your xhtml;
Exp;

Code: Select all

<a href="#" jsf:action="#{logoutBean.logout}""><span class="topbar-item-text">Logout</span><span class="topbar-icon fa fa-sign-out"></span></a>
http://www.oracle.com/technetwork/artic ... 27136.html
http://www.beyondjava.net/blog/jsf-2-2- ... eat-sheet/

jblaplace
Posts: 3
Joined: 29 Sep 2016, 01:55

07 Oct 2016, 20:34

Hi,

Thanks for the trick. I will give it a shot.
In the mean time I added the color entry in .topbar #topbar-menu a of the layout CSS.

Cheers.

JB

User avatar
aragorn
Posts: 2366
Joined: 29 Jun 2013, 12:38

10 Oct 2016, 09:37

Ok. Thanks for the update!

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest