Skip to content

Instantly share code, notes, and snippets.

@glebtv
Created August 2, 2016 09:53
Show Gist options
  • Save glebtv/706ab0d0208ba3bd7707091dcb00a331 to your computer and use it in GitHub Desktop.
Save glebtv/706ab0d0208ba3bd7707091dcb00a331 to your computer and use it in GitHub Desktop.
class NavRenderer < SimpleNavigation::Renderer::List
def icon_for(item)
(if item.send(:options)[:icon]
"<img class='icon' src='#{item.send(:options)[:icon]}' alt=''/> ".html_safe
else
""
end) + item.name
end
def tag_for(item)
if suppress_link?(item)
content_tag('span', icon_for(item), link_options_for(item).except(:method))
else
link_to(icon_for(item), item.url, options_for(item))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment