Here's how I'd do it:
%li{:class => current_page?(user_history_path) ? 'current' : nil}
= link_to_unless_current "All Activity", user_history_path(@user)
- Nathan
Joe Van Dyk wrote:
> Oops, I meant this for my best shot:
>
> %li{:class => "#{'current' if current_page?
> (user_history_path(@user))}"}
> = link_to_unless_current "All Activity", user_history_path(@user)
>
> Joe
>
>
> On Oct 5, 4:16 pm, Joe Van Dyk <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>>
>> We're trying to do something like:
>>
>> %li.current= link_to_unless_current "All Activity",
>> user_history_path(@user)
>>
>> But have the .current class given to the <li> element only if they are
>> on user_history_path(@user).
>>
>> This is my best shot at it:
>>
>> %li{:class => "#{'current' if current_page?
>> (user_profile_history_path(@user_profile))}"}
>> = link_to_unless_current "All Activity", user_history_path(@user)
>>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---