Sha256: 9a16b4999c3a65d29e2040ffb70f403145a82d3385eaaa180b4655006d735281

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

<% if tree.root? 
  tree.each do |branch|
    if branch.object.is_a?(Lolita::Mapping)
      branch.options[:url]||=lolita_resources_path(branch.object)
    else
      branch.options[:url]=if branch.options[:url].respond_to?(:call)
        branch.options[:url].call(self,branch)
      else
        branch.options[:url]
      end
    end
  end
end %>
<ul <%=!tree.root? ? "class='subtree'" : ""%> >
  <% last_branch=tree.branches.last %>
  <%tree.branches.each do |branch| 
     if branch.object.is_a?(Lolita::Mapping) 
       active=if self.respond_to?(:resource_class)
          branch.object.to==resource_class
        else
          branch.options[:url]==request.path
        end
     else  
       active=branch.self_with_children.detect{|b| b.options[:url]==request.path}
     end 
     
    %>
    <li class="<%=active ? "active" : ""%> <%=branch.children.branches.any? ? "with-subtree" : ""%> <%=!tree.root? && branch==last_branch ? "last-in-subtree" : ""%>">
      <%= link_to branch.title, branch.options[:url] || "#" %>
      <% if branch.children.branches.any? %>
        <%= render_component(:"lolita/navigation",:tree,:tree=>branch.children) %>
      <% end %>
    </li>
  <% end %>
</ul>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lolita-3.1.5 app/views/components/lolita/navigation/_tree.html.erb