{% extends "coprs/detail.html" %}
{% from "_helpers.html" import copr_name, warn_server_admin %}
{% block title %}Settings {{ copr_name(copr) }}{% endblock %}

{% set selected_tab = "settings" %}


{%block project_breadcrumb %}
  <li>
    {% set settings_view = 'coprs_ns.copr_edit' if g.user and g.user.can_edit(copr) else 'coprs_ns.copr_permissions' %}
    <a href="{{ copr_url(settings_view, copr) }}">Settings</a>
  </li>
  <li class="active">
    {%block settings_breadcrumb %}
    {%endblock%}
  </li>
{%endblock%}


{% macro tab(tab_name, tab_title, href) %}
<li class="{% if selected_monitor_tab == tab_name %}active{% endif %}">
  <a href="{{ href }}">
    {{ tab_title }}
  </a>
</li>
{% endmacro %}


{% block detail_body %}

{{ warn_server_admin(copr) }}

<ul class="nav nav-tabs nav-tabs-pf">


{% if g.user %}
  {% if g.user.can_edit(copr) %}
    {{ tab("edit", "Project Details", copr_url('coprs_ns.copr_edit', copr)) }}
  {% endif %}

  {% if g.user.can_edit(copr) %}
    {{ tab("permissions", "Permissions", copr_url('coprs_ns.copr_permissions', copr)) }}
  {% endif %}

  {% if g.user.can_edit(copr) %}
    {{ tab("integrations", "Integrations", copr_url('coprs_ns.copr_integrations', copr)) }}
  {% endif %}

  {% if g.user.can_edit(copr) %}
    {{ tab("repositories", "Repositories", copr_url('coprs_ns.copr_repositories', copr)) }}
  {% endif %}

  {% if g.user.can_edit(copr) %}
    {{ tab("delete", "Delete Project", copr_url('coprs_ns.copr_delete', copr)) }}
  {% endif %}
{% endif %}

</ul>

{% block tab_content %}{% endblock %}

{% endblock %}
