{% extends "valet_keys/base.html" %}

{% block subcontent %}
<p>
    These are your API keys. They're useful for building applications that
    perform tasks on MDN on your behalf. If you have stopped using any of
    them, or suspect one has been exposed to parties you don't trust with your
    account, click the <span class="button">X</span> to delete the key.  It's
    easy to create a replacement key at any time.
</p>
<p><a class="button positive" href="{% url valet_keys.new %}">Create a new key</a></p>
{% if not keys %}
    <p>You have no API keys, yet.</p>
{% else %}
    <table class="keys" cellpadding="4">
        {% for key in keys %}
        <tr id="key-{{ key.pk }}" class="key{% if key.is_disabled %} disabled{% endif %}">
            <td class="actions">
                <a class="button positive"
                   title="View key usage history"
                   href="{% url valet_keys.history key.pk %}">History {{ key.history.count }}</a>
                {% if not key.is_disabled %}
                    <a class="button negative"
                       title="Disable key"
                       href="{% url valet_keys.views.disable key.pk %}">X</a>
                {% endif %}
            </td>
            <td class="created">{{ key.created }}</td>
            <td class="description">
                <span>{{ key.description }}</span>
                {% if key.is_disabled %}(disabled){% endif %}
            </td>
        </tr>
        {% endfor %}
    </table>
{% endif %}
{% endblock %}
