Skip to content

Instantly share code, notes, and snippets.

@azuby
Created June 15, 2013 02:29
Show Gist options
  • Save azuby/5786550 to your computer and use it in GitHub Desktop.
Save azuby/5786550 to your computer and use it in GitHub Desktop.
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