Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. def li_menu_item(title, path, options = {})
  2. options.reverse_merge!(:class => '')
  3. # puts request.path
  4.  
  5. if path.index('?')
  6. @path = path.slice(0...path.index('?'))
  7. else
  8. @path = request.path
  9. end
  10. # raise 'e'
  11. if (request.path.match(/#{@path}/) && path != "/") || (request.path == "/" && path == "/")
  12. raw '<li class="active">' << link_to(title, path, options) << '</li>'
  13. else
  14. raw '<li>' << link_to(title, path, options) << '</li>'
  15. end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement