{% extends "osusers/base.html" %}
{% load i18n crispy_forms_tags %}

{% block title %}{{ block.super }} - {% spaceless %}
    {% if user == customer %}
        {% blocktranslate %}SSH Public Keys for Operating System User {{ osuser }}{% endblocktranslate %}
    {% else %}
        {% blocktranslate with full_name=customer.get_full_name trimmed %}
            SSH Public Keys for Operating System User {{ osuser }} of Customer {{ full_name }}
        {% endblocktranslate %}
    {% endif %}
{% endspaceless %}{% endblock title %}

{% block page_title %}{% spaceless %}
    {% if user == customer %}
        {% blocktranslate trimmed %}
            SSH Public Keys <small>for Operating System User {{ osuser }}</small>
        {% endblocktranslate %}
    {% else %}
        {% blocktranslate with full_name=customer.get_full_name trimmed %}
            SSH Public Keys <small>for Operating System User {{ osuser }} of Customer {{ full_name }}</small>
        {% endblocktranslate %}
    {% endif %}
{% endspaceless %}{% endblock page_title %}

{% block content %}
    {% if keys %}
        <table class="table">
            <thead>
            <tr>
                <th class="name-column">{% translate "Algorithm" %}</th>
                <th>{% translate "Comment" %}</th>
                <th title="{% translate "SSH public key actions" %}" class="actions-column"><span
                        class="visually-hidden">{% translate "Actions" %}</span></th>
            </tr>
            </thead>
            <tbody>
            {% for key in keys %}
                <tr>
                    <td>{{ key.algorithm }}</td>
                    <td>{{ key.comment }}</td>
                    <td>
                        <a href="{% url 'delete_ssh_key' package=hostingpackage.id pk=key.id %}"
                           title="{% translate "Delete this SSH public key" %}"><i
                                class="glyphicon glyphicon-trash"></i><span
                                class="visually-hidden"> {% translate "Delete" %}</span></a>
                        <a href="{% url 'edit_ssh_key_comment' package=hostingpackage.id pk=key.id %}"
                           title="{% translate "Edit this SSH public key's comment" %}"><i
                                class="glyphicon glyphicon-pencil"></i><span
                                class="visually-hidden"> {% translate "Edit Comment" %}</span></a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p class="bg-warning">{% translate "There are now SSH public keys set for this operating system user yet." %}</p>
    {% endif %}
    <p><a href="{% url 'add_ssh_key' package=hostingpackage.id %}"
          class="btn btn-primary">{% translate "Add SSH public key" %}</a></p>
{% endblock content %}