Sha256: 909b5ea57ca7cd52c0d263bbde719d519ecf77827a1a199874c970b106455af3

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 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 ? branch.object.to==resource_class : false
        end
     end 
     unless active
       active=branch.self_with_children.detect{|b| 
         if b.options[:active].respond_to?(:call)
          b.options[:active].call(self,branch,b)
         else
          b.options[:url]==request.path
         end
       }
     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.10 app/views/components/lolita/navigation/_tree.html.erb