Created
September 18, 2013 19:30
-
-
Save guillermorangel/6614293 to your computer and use it in GitHub Desktop.
Extend link helper, link_to, to add "active" class if link url is to current page.
https://github.com/middleman/middleman/issues/303
This file contains hidden or 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
helpers do | |
def magic_link_to(link, url, opts={}) | |
if request.path == link | |
opts[:class] = "active" | |
end | |
link_to(link, url, opts) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment