Created
August 2, 2016 09:53
-
-
Save glebtv/706ab0d0208ba3bd7707091dcb00a331 to your computer and use it in GitHub Desktop.
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
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