{% extends "base.html" %}

{% load common bootstrap3 %}

{% block page_title %}Repository - {{ repo }} {% endblock %}

{% block breadcrumbs %} {{ block.super }} <li><a href="{% url 'repos:repo_list' %}">Repositories</a></li><li class="active">{{ repo }}</li>{% endblock %}

{% block content_title %} Repository - {{ repo }} {% endblock %}

{% block content %}

<div class="well well-sm">
  <table class="table table-striped table-bordered table-hover table-condensed table-responsive">
    <tr><th>Name</th><td> {{ repo.name }} </td></tr>
    <tr><th>ID</th><td> {% if repo.id != None %} {{ repo.id }} {% endif %}</td></tr>
    <tr><th>Type</th><td> {{ repo.get_repotype_display }} </td></tr>
    <tr><th>Architecture</th><td> {{ repo.arch }} </td></tr>
    <tr><th>Security</th><td> {% yes_no_img repo.security 'Security' 'Not Security' %} </td></tr>
    <tr><th>Enabled</th><td> {% yes_no_img repo.enabled 'Enabled' 'Not Enabled' %} </td></tr>
    <tr><th>Mirrors</th><td> {{ repo.mirror_set.count }} </td></tr>
    <tr><th>Requires Authentication</th><td> {{ repo.auth_required }} </td></tr>
  </table>

  <div class="panel panel-danger">
    {% if user.is_authenticated and perms.is_admin %}
      <div class="panel-heading">
        Are you sure you want to delete this Repository? This will also delete all Mirrors linked to this Repository.
      </div>
      <div class="panel-body">
        <form action={{ request.path }} method="post">
          {% csrf_token %}
          <button name="delete" type="submit" class="btn btn-primary btn-sm">{% bootstrap_icon "trash" %} Delete</button>
          <button name="cancel" type="submit" class="btn btn-primary btn-sm">{% bootstrap_icon "stop" %} Cancel</button>
        </form>
      </div>
    {% else %}
      <div class="panel-heading">
        You do not have permission to delete this Repository.
      </div>
      <div class="panel-body">
        <a class="btn btn-primary btn-sm" href="{{ repo.get_absolute_url }}">{% bootstrap_icon "arrow-left" %} Back</a>
      </div>
    {% endif %}
  </div>
</div>

{% endblock %}
