Return to Snippet

Revision: 21692
at December 18, 2009 12:00 by smoothdzion


Initial Code
def top_menu_li(label,controller,url)
    @current_page = request.request_uri
    @current_controller = request.path_parameters['controller']
    if @current_page == url || @current_controller == controller
      '<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
I needed to make menu items that kept the current class based on the controller being accessed.

Initial Title
RoR Helper - Top Section Menu

Initial Tags
rails

Initial Language
Rails