Posted By

smoothdzion on 12/18/09


Tagged

menu rails ruby helper ror


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

smoothdzion


RoR Helper - Menu Item with Current Class


 / Published in: Rails
 

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

  1. def menu_li(label,url)
  2. @current_page = request.request_uri
  3. if @current_page == url
  4. '<li class="current"><a href="' + url + '" title="' + label + '">' + label + '</a></li>'
  5. else
  6. '<li><a href="' + url + '" title="' + label + '">' + label + '</a></li>'
  7. end
  8. end

Report this snippet  

You need to login to post a comment.