<h1 class='page-header'>Packages</h1>
<div class="row">
  <div class="col-md-3">
    <div class="panel panel-default">
      <div class="panel-heading panel-heading-browse">
        <h2>Browse</h2>
      </div>
      <ul class="list-inline">

        <% @package_prefixes.each do |prefix| %>
          <li><h5><a href="/packages/<%= prefix %>/"><%= prefix %></a></h5></li>
        <% end %>
        <% if @package_prefixes.empty? %>
          <li><em>(no data yet)</em></li>
        <% end %>

      </ul>
    </div>
  </div>

  <div class="col-md-9">
    <% @repository.search('^' + (@prefix || '-')).tap do |packages| %>
      <table class="table" style="text-align: left">
        <tr>
          <td><b>Package</b></td>
          <td><b>Status</b></td>
        </tr>
        <% packages.each do |package| %>
          <tr>
            <td><a href="/packages/<%= @prefix %>/<%= package.name %>"><%= package.name %></a></td>
            <% if package.fail_or_neutral.any? %>
              <td>
                <% package.fail_or_neutral.each do |s| %>
                  <a href='<%= "/packages/#{@prefix}/#{package.name}/#{s.suite}/#{s.architecture}"%>'>
                    <%= icon(s.extended_status) %>
                    <%= s.version %> <%= s.status.upcase %> <%= s.suite %>/<%= s.architecture %> <%= s.failmsg && '(%s)' % s.failmsg %>
                  </a>
                <% end %>
              </td>
            <% else %>
              <td>
                <div><i class='pass fa fa-thumbs-up'></i> Passing everywhere</div>
              </td>
            <% end %>
          </tr>
        <% end %>
      </table>
    <% end %>
  </div>
</div>
