<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
  <style type="text/css"><%= bootstrap %></style>
  <style type="text/css">
    body {
      margin: 50px;
    }
    .dependencies blockquote {
      margin-top: 15px;
    }
  </style>
</head>
<body>
<div class="container">
  <h1><%= project_name %></h1>
  <div class="summary hero-unit">
    <div class="row">
      <div class="span5">
        <h2>Dependencies</h2>

        <p>As of <%= Time.now.strftime("%B %e, %Y %l:%M%P") %></p>

        <h4><%= dependencies.size %> total</h4>

        <ul>
          <% grouped_dependencies.each do |license_name, group| -%>
            <li><%= group.size %> <%= license_name %></li>
          <% end -%>
        </ul>
      </div>
      <% if unapproved_dependencies.any? -%>
        <div class="action-items span5">
          <h2>Action Items</h2>
          <h4>
            <%= unapproved_dependencies.size %> unapproved
            <span class="badge badge-important">&#x2717;</span>
          </h4>
          <ul>
            <% unapproved_dependencies.each do |dependency| -%>
              <li>
              <%= link_to dependency.name %>
              (<%= license_names(dependency) %>)
              </li>
            <% end -%>
          </ul>
        </div>
      <% end -%>
    </div>
  </div>
  <div class="dependencies">
    <% sorted_dependencies.each do |dependency| -%>
      <div id="<%= dependency.name %>" class="clearfix <%= dependency.approved? ? "approved" : "unapproved" %>">
        <blockquote class="pull-right">
          <% if dependency.approved_manually? -%>
            <p>
            <%= license_links(dependency) %>
              manually approved
              <span class="badge badge-success">&#x2713;</span>
            </p>
            <p><%= dependency.manual_approval.why %></p>
            <small>
              <% if dependency.manual_approval.who -%>
                <%= dependency.manual_approval.who %>,
              <% end -%>
              <time datetime="<%= dependency.manual_approval.safe_when.utc.iso8601 %>"><%= dependency.manual_approval.safe_when.to_date %></time>
            </small>
          <% elsif dependency.permitted? -%>
            <p>
              <%= license_links(dependency) %>
              permitted
              <span class="badge badge-success">&#x2713;</span>
            </p>
          <% else -%>
            <p>
            <%= license_links(dependency) %>
            unapproved
            <span class="badge badge-important">&#x2717;</span>
            </p>
          <% end -%>
        </blockquote>
        <h2>
          <%= link_to_dependency(dependency) %>
          <small><%= version_groups(dependency) %></small>
        </h2>
        <% if dependency.is_a?(MergedPackage) && !dependency.aggregate_paths.nil? && dependency.aggregate_paths.count > 0-%>
        <h4>Paths</h4>
        <dl>
          <% dependency.aggregate_paths.each do |path| -%>
          <dd><%= path %></dd>
          <% end -%>
        </dl>
        <% end -%>
        <h4><%= dependency.summary %></h4>
        <p><%= dependency.description %></p>
        <% if dependency.parents.any? -%>
          <dl>
            <dt><%=dependency.name%> is required by:</dt>
            <dd><%= dependency.parents.to_a.join(", ") -%></dd>
          </dl>
        <% end -%>
        <% if dependency.children.any? -%>
          <dl>
            <dt><%=dependency.name%> relies on:</dt>
            <dd><%= dependency.children.join(", ") -%></dd>
          </dl>
        <% end -%>
      </div>
    <% end -%>
  </div>
</div>
</body>
</html>
