NARKOZ/ginatra

View on GitHub
views/tree.erb

Summary

Maintainability
Test Coverage
<% title "#{@repo.name} at #{@tree.oid[0..6]}" %>

<div id="pjax-container">
  <%= partial :tree_nav %>

  <div id="loader"><img src="<%= prefix_url("img/loader.svg") %>" alt="loading"></div>

  <div class="list-group" id="js-tree">
    <% @tree.each do |tree| %>
      <% next unless tree[:type] == :commit && tree[:filemode] == 57344 %>
      <a title="submodule <%= tree[:name] %> @ <%= tree[:oid] %>" class="list-group-item">
        <img src="/img/hdd-o.svg" alt="submodule" class="icon"> <%= tree[:name] %>
      </a>
    <% end %>

    <% @tree.each_tree do |tree| %>
      <a href="<%= prefix_url(@path[:tree]) %>/<%= tree[:name] %>" class="list-group-item">
        <img src="/img/folder.svg" alt="folder" class="icon"> <%= tree[:name] %>
      </a>
    <% end %>

    <% @tree.each_blob do |blob| %>
      <a href="<%= prefix_url(@path[:blob]) %>/<%= blob[:name] %>" class="list-group-item">
        <%= file_icon blob[:filemode] %> <%= blob[:name] %>
      </a>
    <% end %>
  </div>
</div>