{% extends "admin.html" %}

{% block admin %}
<div class="center">
    <h1>{{ link.title }}</h1>
    <table>
        <tr>
            <td>{{ fluent(key="link-description", lang=user.language)
                }}:</td>
            <td>{{ link.title }}</td>
        </tr>
        <tr>
            <td>{{ fluent(key="link-code", lang=user.language)
                }}:</td>
            <td>{{ link.code }}</td>
        </tr>
        <tr>
            <td>{{ fluent(key="shortlink", lang=user.language)
                }}:</td>
            <td><a href="{{ protocol }}://{{ host }}/{{ link.code }}">{{ protocol }}://{{ host }}/{{ link.code }}</a>
            </td>
        </tr>
        <tr>
            <td>{{ fluent(key="link-target", lang=user.language)
                }}:</td>
            <td>{{ link.target }}</td>
        </tr>
        <tr>
            <td>{{ fluent(key="qr-code", lang=user.language)
                }}</td>
            <td><a href="/admin/download/png/{{ link.code }}" download="{{ link.title | slugify }}.png">
                    {{ qr | trim_start_matches(pat=
                    '.*?>')
                    | safe }}
                </a>
            </td>
        </tr>
    </table>
    {% if user.role == 2 or user.id == link.author %}
    <div class="actions">
        <a class="button" href="/admin/edit/link/{{ link.code }}">{{ fluent(key="edit-link", lang=user.language)
            }}</a>
    </div>
    {% endif %}
</div>
{% endblock %}