{% extends "coprs/detail.html" %}
{% from "_helpers.html" import render_pagination, copr_name %}
{% from "coprs/detail/_packages_table.html" import packages_table with context %}
{% from "coprs/detail/_build_states.html" import build_states %}

{% block title %}Packages for {{ copr_name(copr) }}{% endblock %}
{% set selected_tab = "packages" %}

{%block project_breadcrumb %}
<li class="active">
  Packages
</li>
{%endblock%}

{% block detail_body %}
{% if g.user and g.user.can_edit(copr) %}
  <a class="btn btn-primary button-new pull-right" href="{{ copr_url('coprs_ns.copr_add_package', copr) }}"><span class="pficon pficon-add-circle-o"></span> New package </a>
{% endif %}
{% if g.user and g.user.can_build_in(copr) %}
  <a class="btn btn-default button-new pull-right" style="margin-right:5px" href="{{ copr_url('coprs_ns.copr_rebuild_all_packages', copr) }}"><span class="pficon pficon-restart"></span> Rebuild all </a>
{% endif %}
<h2 class="page-title">Project Packages</h2>

{% if packages %}
  {{ packages_table(packages, serverside_pagination=serverside_pagination) }}
{% else %}
<div class="blank-slate-pf">
  <div class="blank-slate-pf-icon">
    <span class="pficon pficon pficon-add-circle-o"></span>
  </div>
  <h1>
    No Packages in This Project
  </h1>
  <p>
    Packages can be used to create <strong>automatic builds</strong> from your git repository. To do this, create a new package and fill in its default source.
  </p>
  {% if g.user and g.user.can_edit(copr) %}
  <div class="blank-slate-pf-main-action">
    <a class="btn btn-primary btn-lg" href="{{ copr_url('coprs_ns.copr_add_package', copr) }}"> Create a New Package </a>
  </div>
  {% endif %}
</div>
{% endif %}

{% endblock %}
