Created
December 11, 2012 22:13
-
-
Save bearroast/4262796 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nav_link(link_text, link_path, more_args = nil) | |
# link_text: text on the button or link | |
# link_poth: link url | |
# more_args: anything you need, like id, alt or title | |
class_name = current_page?(link_path) ? 'active' : nil # see if current page is on the link path and apply class 'active', else do nothing | |
content_tag(:li, :class => class_name) do | |
link_to link_text, link_path, more_args | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment