<%inherit file="master.html"/>

<script src="${request.static_url('bodhi:server/static/js/newsfeed.js')}"></script>
<div class="container p-t-2">

  <!--<div id="newsfeed" class="col-md-6">
    <img src="${request.static_url('bodhi:server/static/img/spinner.gif')}"
         alt="Loading..."
         id="loader" />
    <div id="datagrepper-widget"></div>
    <script>
        $(document).ready(function() {
          generate_newsfeed(
            "${request.registry.settings.get('datagrepper_url')}",
            ${str(request.registry.settings.get('badge_ids')) | n});
        });
    </script>
  </div>-->

  % for r in request.releases['pending'] + request.releases['current']:
  <div class="row front-release">
    <div class="col-md-12">
      <h3>
        <a class="notblue" href="${request.route_url('releases')}${r['name']}">
  ${r['long_name']}
        </a>
        %if r['state'] == 'pending':
          <span class="label label-default">prerelease</span>
        %endif
      </h3>
    </div>
      <div class="col-md-4">
        <div class="front-count">
        <div class="front-count-total">
          <a href="${request.route_url('updates')}?releases=${r['name']}&amp;status=pending">
          ${release_updates_counts[r['name']]['pending_updates_total']}
          </a>
        </div>
        <h4>updates pending</h4>
          <a class="text-danger" title="Security updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=pending&amp;type=security">
            <span class="fa fa-shield"></span> ${release_updates_counts[r['name']]['pending_security_total']}
          </a>
          <a class="text-warning" title="Bugfix updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=pending&amp;type=bugfix">
            <span class="fa fa-bug"></span> ${release_updates_counts[r['name']]['pending_bugfix_total']}
          </a>
          <a class="text-success" title="Enhancement updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=pending&amp;type=enhancement">
            <span class="fa fa-bolt text-success"></span> ${release_updates_counts[r['name']]['pending_enhancement_total']}
          </a>
          <a class="text-primary" title="New Package updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=pending&amp;type=newpackage">
            <span class="fa fa-archive"></span> ${release_updates_counts[r['name']]['pending_newpackage_total']}
          </a>
      </div>
      </div>
      <div class="col-md-4">
        <div class="front-count">
        <div class="front-count-total">
          <a href="${request.route_url('updates')}?releases=${r['name']}&amp;status=testing">
          ${release_updates_counts[r['name']]['testing_updates_total']}
          </a>
          </div>
        <h4>updates in testing</h4>
        <a class="text-danger" title="Security updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=testing&amp;type=security">
          <span class="fa fa-shield"></span> ${release_updates_counts[r['name']]['testing_security_total']}
        </a>
        <a class="text-warning" title="Bugfix updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=testing&amp;type=bugfix">
          <span class="fa fa-bug"></span> ${release_updates_counts[r['name']]['testing_bugfix_total']}
        </a>
        <a class="text-success" title="Enhancement updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=testing&amp;type=enhancement">
          <span class="fa fa-bolt"></span> ${release_updates_counts[r['name']]['testing_enhancement_total']}
        </a>
        <a class="text-primary" title="New Package updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=testing&amp;type=newpackage">
          <span class="fa fa-archive"></span> ${release_updates_counts[r['name']]['testing_newpackage_total']}
        </a>
        </div>
      </div>
      <div class="col-md-4">
        <div class="front-count">
        <div class="front-count-total">
          <a href="${request.route_url('updates')}?releases=${r['name']}&amp;status=stable">
          ${release_updates_counts[r['name']]['stable_updates_total']}
          </a>
        </div>
        <h4>updates in stable</h4>
        <a class="text-danger" title="Security updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=stable&amp;type=security">
        <span class="fa fa-shield"></span> ${release_updates_counts[r['name']]['stable_security_total']}
        </a>
        <a class="text-warning" title="Bugfix updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=stable&amp;type=bugfix">
        <span class="fa fa-bug"></span> ${release_updates_counts[r['name']]['stable_bugfix_total']}
        </a>
        <a class="text-success" title="Enhancement updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=stable&amp;type=enhancement">
        <span class="fa fa-bolt"></span> ${release_updates_counts[r['name']]['stable_enhancement_total']}
        </a>
        <a class="text-primary" title="New Package updates" data-toggle="tooltip" href="${request.route_url('updates')}?releases=${r['name']}&amp;status=stable&amp;type=newpackage">
        <span class="fa fa-archive"></span> ${release_updates_counts[r['name']]['stable_newpackage_total']}
        </a>
      </div>
      </div>
  </div>
  % endfor

  <div class="row">
    <div class="col-md-12">
          <div class="card">
            <div class="card-header">
              <span><strong>This week's top testers</strong></span>
            </div>
            <div class="list-group list-group-flush">
                % for tester, count in top_testers:
                <div class="list-group-item">
                    <strong>#${str(loop.index + 1)}</strong>
                    <a href="${request.route_url('user', name=tester['name'])}">
                      <img class="img-circle" src="${self.util.avatar(tester['name'], size=24)}"/>
                      ${tester['name']}
                    </a>
                  <div class="label label-default pull-xs-right">${str(count)}</div>
                </div>
                % endfor
            </div>
      </div>
    </div>
  </div>

      % if critpath_updates:
      <div class="row">
        <div class="col-md-12">
          <div class="card">
            <div class="card-header clearfix">
              <span><strong><a href="${request.route_url('updates')}?status=testing&critpath=True" title="View All">Latest Critical Path Updates in Need of Testing</a></strong></span>
              <span class="pull-xs-right">
                <a class="btn btn-sm btn-secondary" href="${request.route_url('updates_rss')}?status=testing" title="RSS Feed">
                  <span class="fa fa-rss"></span>
                </a>
              </span>
            </div>
            <div class="card-block p-a-0">
              ${self.tables.updates(critpath_updates)}
            </div>
          </div>
        </div>
      </div>
      % endif

      % if security_updates:
      <div class="row">
        <div class="col-md-12">
          <div class="card">
            <div class="card-header clearfix">
              <span><strong><a href="${request.route_url('updates')}?type=security&status=testing">Latest Security Updates in Need of Testing</a></strong></span>
              <span class="pull-xs-right">
                <a class="btn btn-sm btn-secondary" href="${request.route_url('updates_rss')}?type=security&status=testing" title="RSS Feed">
                  <span class="fa fa-rss"></span>
                </a>
              </span>
            </div>
            <div class="card-block p-a-0">
              ${self.tables.updates(security_updates)}
            </div>
          </div>
        </div>
      </div>
      %endif
  </div>
</div>
