Hey there,
I tried to integrate an active navigation menu, but none of the pages I found helped me. So I start this topic here. What I want to have is a navigation menu, that highlights the current page. So far so good. I have a layout.erb which designs my pages so I just have to fill it all with content and not create the whole site again and again and again. Some instructions I found with Google said, that I should create a individual navigation menu for every page with an active navigation for the current site. But my navigation menu is created in the layout.erb so this wonāt work. Another instruction said I should create this helper
helpers do
def nav_active(page)
@page_id == page ? {:class => "Active"} : {}
end
def path(page)
t("paths.#{page}")
end
end
And the to use this
<li class="first"><%= link_to "Home", "/", title: "home", :class => ('active' if @home) %></li>
as navigation menu. But this still doesnāt work. Anything who could give me another instruction to make this navigation menu
<div id="primary_navigation">
<ul>
<li class="first"><%= link_to "Home", "/", title: "Home" %></li>
<li><%= link_to "Link1", "/link1.html", title: "link1" %></li>
<li><%= link_to "Link2", "/link2.html", title: "link2" %></li>
<li><%= link_to "Link3", "/link3.html", title: "link3" %></li>
<li><%= link_to "Link4", "/link4.html", title: "link4" %></li>
<li><%= link_to "Link5", "/link5.html", title: "link5" %></li>
<li class="last"><%= link_to "Link6", "/link6.html", title: "link6" %></li>
</ul>
</div>
an active navigation?
Thanks a lot and sorry if bad english, Iām not as fit in english as I should/would be. But Iām working on it