Created
May 20, 2009 03:17
-
-
Save kent/114588 to your computer and use it in GitHub Desktop.
Rails Tabbed Navigation Helper
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 layout_link_to(link_text, path, opts = {}) | |
curl = url_for(:controller => request.path_parameters['controller'], | |
:action => request.path_parameters['action']) | |
html = '' | |
options = curl.include?(path) ? {:class => 'current'} : {} | |
if opts[:class] && options[:class] | |
options[:class] = "current #{opts[:class]}" | |
else | |
options.merge!(opts) | |
end | |
html << content_tag("li", link_to(link_text, path, options)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment