<div class="row mb-3 mt-3">
    <a role="button" class="btn btn-primary" href="{{ path('user_account_token_create') }}">Create token</a>
</div>

<table class="table">
    <thead>
    <tr>
        <th scope="col">Token</th>
        <th scope="col">RSS link</th>
        <th scope="col">Created</th>
        <th scope="col">Actions</th>
    </tr>
    </thead>

    <tbody>
    {% for token in tokens %}
    <tr>
        <th scope="row">
            <code>{{ token.key }}</code>
        </th>
        <td>
            {# We can't use constant() in the hash so it's necessay to hard-code query parameter here #}
            <input class="form-control" type="text" value="{{ url('api_v1_rss_last') }}?{{ {'api-token': token.key} | url_encode }}" readonly onclick="this.select();">
        </td>
        <td>
            {{ token.createdAt | date('Y-m-d H:i:s') }}
        </td>
        <td>
            <a role="button" class="btn btn-danger" href="{{ path('user_account_token_revoke', {'key': token.key}) }}" onclick="return confirm('Are you sure?')">Revoke</a>
        </td>
    </tr>
    {% endfor %}
    </tbody>
</table>