Hi guys, I can't seem to make this code work on my project.
This is the code in my config.rb
active_nav = {:class => "Active"}
// Changed it to nav_active hoping it would work but it didn't.
helpers do
def nav_active(page)
@page_id == page ? {:class => "Active"} : {}
end
def path(page)
("#{page}.html")
end
end
This is the code in my _header.haml
%li{nav_active("index")}= link_to ('Home'), path('index')
%li{nav_active("page")}= link_to ('Fast Facts'), path('page')
My html links are:
- index.html.haml
- page.html.haml
Output is still
<li><a href="/">Home</a></li>
<li><a href="/page.html">Fast Facts</a></li>