{% load i18n %}
{% load icons %}
{% load translations %}

{% for ssh_key in public_ssh_keys.values %}
  {% if ssh_key.key %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <h4 class="panel-title">
          {% documentation_icon 'vcs' 'ssh-repos' right=True %}
          {% blocktrans with key_type=ssh_key.name %}Public {{ key_type }} SSH key{% endblocktrans %}
        </h4>
      </div>
      <div class="panel-body">
        <button type="button" class="btn btn-link btn-xs pull-right flip" data-clipboard-text="{{ ssh_key.key }}" data-clipboard-message="{% trans "Public key copied to clipboard." %}" title="{% trans "Copy to clipboard" %}">{% icon "copy.svg" %}</button>
        <p>{% blocktrans %}Weblate uses SSH key to access remote repositories. The corresponding public key is found below, you can use it to grant Weblate access to a repository.{% endblocktrans %}</p>
        <div class="list-group-item pre-scrollable">
          {{ ssh_key.key|linebreaks }}
        </div>
      </div>
      {% if key_download %}
        <div class="panel-footer">
          <a href="{% url 'manage-ssh-key' %}?type={{ ssh_key.type }}" class="btn btn-primary">
            {% blocktrans with key_type=ssh_key.name %}Download {{ key_type }} private key{% endblocktrans %}
          </a>
        </div>
      {% endif %}
    </div>
  {% endif %}
{% endfor %}
