Return to Snippet

Revision: 21693
at December 18, 2009 12:02 by smoothdzion


Initial Code
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

Initial URL

                                

Initial Description
Regular menu item adding current class if current url equal menu item destination.

Initial Title
RoR Helper - Menu Item with Current Class

Initial Tags
rails, ruby

Initial Language
Rails