I have the following line of code in a haml file
%a#mypage{:href => hub_path(@user), :class => "#{path.match('(hub)') ? 'current': ''}"}
What this does is ensure the correct item on a navigation bar is highlighted. However, I need the same item to be highlighted if any one of several paths are matched.
So, above we have the path matched to hub. I need it to return true if the path is matched to hub, or item2, or item3.
No idea where to begin. I've tried putting in "||" into the class to see if I could just list them but this didn't work. Is there a way to do "includes" when specifying the match?
Aucun commentaire:
Enregistrer un commentaire