Skip to content
scarfaceDeb edited this page Feb 27, 2013 · 1 revision

want a suckerfish dropdown?

  def suckerfish(node)
    fuc = lambda do |nodes|
      return "" if nodes.empty?
      return "<ul>" +
        nodes.inject("") do |string, (node, children)|
          string + "<li rel='#{node.id}'>" +
          link_to(node.name, node.path) +
          fuc.call(children) +
          "</li>"
        end +
        "</ul>"
    end
    fuc.call(node.descendants.arrange)
  end