{% extends "admin/base_site.html" %}
{% load i18n %}
{% load cycle from future %}

{% block title %}{% trans "SSH keys" %}{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs"><a href="../">
{% trans "Home" %}</a> &rsaquo; {% trans "SSH keys" %}
</div>{% endblock %}

{% block content %}
<div id="content-main">
    {% if public_key %}
    <h1>{% trans "Public SSH key" %}</h1>
    <p>{% trans "Weblate currently uses following SSH key:" %}</p>
    <form>
    <textarea style="width:100%">{{ public_key.key }}</textarea>
    </form>


    {% elif can_generate %}
    <h1>{% trans "Generate SSH key" %}</h1>
    <p>{% trans "You don't seem to have existing SSH key, by pressing button below Weblate will generate it for you." %}</p>
    <form method="post">
    {% csrf_token %}
    <input type="hidden" name="action" value="generate" />
    <input type="submit" value="{% trans "Generate" %}" />
    </form>

    {% endif %}

    {% if host_keys %}
    <h1>{% trans "Known host keys" %}</h1>

  <div id="changelist" class="module filtered">
    <div class="results">
  <table id="result_list">
  <thead>
  <tr>
    <th>{% trans "Hostname" %}</th>
    <th>{% trans "Key type" %}</th>
    <th>{% trans "Fingerprint" %}</th>
  </tr>
  </thead>
  <tbody>
    {% for key in host_keys %}
    <tr class="row{% cycle '1' '2' %}"><td>{{ key.0 }}</td><td>{{ key.1 }}</td><td>{{ key.2 }}</td></tr>
    {% endfor %}
  </tbody>
    </table>
</div>
</div>
    {% endif %}

    <h1>{% trans "Add host key" %}</h1>
    <p>{% trans "To access SSH hosts, it's host key needs to be verified. You can get the host key by entering a domain name or IP for the host in the form below." %}</p>
    <form method="post">
    {% csrf_token %}
    <input type="hidden" name="action" value="add-host" />
    {% trans "Host:" %}
    <input type="text" name="host" /> 
    {% trans "Port:" %}
    <input type="text" name="port" /><br />
    <input type="submit" value="{% trans "Submit" %}" />
    </form>

    <h1>{% trans "More information" %}</h1>

    <p>{% blocktrans %}You can find more information about setting up SSH keys in <a href="{{ ssh_docs }}">the Weblate manual</a>.{% endblocktrans %}</p>
    
</div>
{% endblock %}
