Created
February 13, 2014 15:48
-
-
Save FineLineAutomation/8977525 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
# link to cart better | |
Spree::BaseHelper.module_eval do | |
def taxons_tree(root_taxon, current_taxon, max_level = 1, root_css_class = nil) | |
return '' if max_level < 1 || root_taxon.children.empty? | |
content_tag :ul, :class => root_css_class do | |
root_taxon.children.map do |taxon| | |
css_class = (taxon.children.empty? || max_level < 2) ? "no_sub_menu" : "has_sub_menu" | |
i_class = (css_class == "no_sub_menu") ? "fi-minus" : "fi-plus" | |
content_tag :li, :class => css_class do | |
content_tag(:i, :class => "nav-collapse " + i_class) do end + | |
link_to(taxon.name, seo_url(taxon)) + | |
taxons_tree(taxon, current_taxon, max_level - 1, "nested") | |
end | |
end.join("\n").html_safe | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment