This is a lot simpler if approached differently. You're trying to apply
context to your pages, so give your pages a context at the body tag level
and use descendant style selectors to style according to context.

%body{:id=> "#{controller_name}-#{action_name}", :class => controller_name}
  %ol#nav
    %li#home-nav= link_to "HOME", home_path, :rel => "home"
    %li#acct-nav= link_to "ACCOUNT", account_path


Corresponding Sass Code:

body.home #home-nav,
body.account #account-nav
  font-weight: bold


Chris

On Fri, Aug 14, 2009 at 9:24 AM, Nathan Weizenbaum <[email protected]> wrote:

> %li{:id => ("selectedHeaderLink" if controller_name == "home")}= link_to
> "HOME", :controller => "home", :action => "index"
>
>
> On Fri, Aug 14, 2009 at 9:15 AM, Alexander Wallace <
> [email protected]> wrote:
>
>> %li{ :id => controller_name.eql?("home") ? "selectedHeaderLink" :
>> "bland-identification" }= link_to "HOME", :controller => "home", :action =>
>> "index"
>>
>>
>> On Fri, Aug 14, 2009 at 4:30 AM, Shuhrat Tursunov <[email protected]>wrote:
>>
>>>
>>> Please, help me rewrite this code in one or two lines.....
>>>
>>>            - if controller_name == 'home'
>>>              %li{:id => "selectedHeaderLink"}= link_to
>>> "HOME", :controller => "home", :action => "index"
>>>            - else
>>>              %li= link_to "HOME", :controller => "home", :action =>
>>> "index"
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to