Created
June 15, 2013 02:29
-
-
Save azuby/5786550 to your computer and use it in GitHub Desktop.
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
def sidebar_link_to(resource, options = {}) | |
options[:action] ||= 'index' | |
return unless can? options[:action], resource | |
options[:title] ||= t("#{resource}.#{options[:action]}.title") | |
content_tag :li, class: 'menu-item' do | |
link_to url_for(action: options[:action], controller: resource), class: 'menu-link' do | |
content_tag(:i, nil, class: "icon-#{options[:icon]}") + | |
options[:title] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment