/ Published in: Rails

Regular menu item adding current class if current url equal menu item destination.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def menu_li(label,url) @current_page = request.request_uri if @current_page == url '<li class="current"><a href="' + url + '" title="' + label + '">' + label + '</a></li>' else '<li><a href="' + url + '" title="' + label + '">' + label + '</a></li>' end end
Comments
